put
https://{shopdomain}.myshoplaza.com/openapi/2022-01/script_tags_new/
Requireswrite_script_tagsaccess scope.More access scope
The Update Script Tag API allows updating an existing script tag in a shop's storefront. This is useful for modifying the behavior, appearance, or scope of the existing script.
This API is especially useful for:
- Modifying script tags after deployment for improved functionality.
- Correcting or updating script configurations without creating new tags.
Request Parameters
Public Request Parameters
Path Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id | string | Yes | Unique identifier of the script tag. | f50950fa-40ec-441f-b98d-e1869050bdf2 |
Body Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
src | string | Yes | Script file URL | https://www.shoplazza.com/x.js |
display_scope | string | Optional | Display scope. | index |
event_type | string | Optional | Tag type. Defaults to app. | myapp |
Response Explanation
Public Response Parameters
Success Response
| Field | Type | Description | Example |
|---|---|---|---|
id | string | Script's unique ID | f50950fa-40ec-441f-b98d-e186905dbf2 |
display_scope | string | Updated display scope | index |
event_type | string | Updated tag type | app |
src | string | Updated script file URL | https://www.shoplazza.com/x.js |
created_at | string | Creation timestamp | 2024-04-29T03:22:50Z |
updated_at | string | Last updated timestamp | 2024-04-29T05:59:40Z |
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 | "page not found" | 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 | |
| 404 | Not found | Script's ID is empty or not provided | "record not found" |
| 422 | Unprocessable Entity | the src url provided is not valid | "src not is file url" |
