patch https://{shopdomain}.myshoplaza.com/openapi/2022-01/themes//doc
Requires
write_themes
access scope. More access scope
The Update Theme File API allows users to update the content of a specific theme file in the selected theme. This enables users to modify existing files, such as layouts, templates, or assets, to customize the shop's design and functionality.
This API is especially useful for:
- Updating theme assets like CSS, JS, or Liquid files.
- Modifying layout or template files for customization.
- Implementing dynamic changes in the theme files directly through API.
Request Parameters
Public Request Parameters
Path Parameters
Name | Type | Required | Description | Example |
---|---|---|---|---|
theme_id | String | Yes | The unique ID of the theme. | 1500021b-88ed-4750-bbc5-97ec98351dc0 |
Body Parameters
Field | Type | Required | Description | Example |
---|---|---|---|---|
doc | Object | Yes | Contains details about the type, location, and content to update. | |
doc.type | String | Yes | The type of file being updated (assets , layout , etc.). | assets |
doc.location | String | Yes | The file's location within the theme. | test.js |
doc.content | String | Yes | The updated content to apply to the file. | "console.log('Hello');" |
Response Explanation
Public Response Parameters
Successful Response
Field | Type | Description | Example |
---|---|---|---|
Object | A successful response returns an empty object {} indicating the update was successful. | {} |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
error | String | "store is not active" | Indicates an error encountered during the process |
Error Detail
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized |