Create a new script
POST
v1/managers/app-scriptsUtilize this endpoint to create a new script. Investigate the available events here.
Request
Preferred language for the response. Defaults to en
if not specified.
The User-Agent header contains information about the user agent (browser or app) making the request. It allows the server to provide a tailored response depending on the user agent's capabilities and preferences.
Specifies the Media Types acceptable for the client. In this case, it signals that the client expects a response in the JSON format.
The Authorization token is a unique key given to the third-party application (Partner) by Zid. It is used to authenticate the API requests made by the Partner application. The token verifies the partner's identity and ensures they have permission to access Zid's API but does not provide any specific user or store information. It should be included in the header of API requests when the partner application needs to access Zid's API.
The Media Type of the body of the request. This is used to describe the structure of the data in the body.
This token is used to authenticate and access information related to the store. It is obtained through an OAuth mechanism and is required to perform operations on the store's data. The X-Manager-Token
should be included in the header of API requests that require store-related information.
The URL of the script file.
JavaScript code to be executed when the Purchase event occurs.
JavaScript code to be executed when the Product Details event occurs.
JavaScript code to be executed when the Add To Cart event occurs.
JavaScript code to be executed when the Remove From Cart event occurs.
JavaScript code to be executed when the Start Checkout event occurs.
{
"url": "https://raw.githubusercontent.com/gharbat/js-cs/main/test.js",
"purchase_event": "console.log(transactionItems)",
"product_details_event": "console.log(productViewd)",
"add_to_cart_event": "console.log(productCart)",
"remove_from_cart_event": "console.log(productCart)",
"start_checkout_event": "console.log(cart)"
}
Request samples
Responses
Successfully created the new script
The URL of the script file.
JavaScript code to be executed when the Purchase event occurs.
JavaScript code to be executed when the Product Details event occurs.
JavaScript code to be executed when the Add To Cart event occurs.
JavaScript code to be executed when the Remove From Cart event occurs.
JavaScript code to be executed when the Start Checkout event occurs.