post

/content/scripts

Creates a Script.

Required Fields

  • name

Read Only Fields

  • uuid

Notes

  • If kind is src –- Only the src property is needed, and you can optionally supply a load_method. The html field should not be specified.
  • If kind is script_tag – Only the script_tag is needed. The src field should not be specified.
  • Each app can have 10 scripts installed.
  • Multiple scripts can be created per call.

Authorization

apiKey - X-Auth-Client
apiKey - X-Auth-Token

Request Parameters

2 Headers

Request Body

3 Examples
Schema
object

Script properties common to post, put, and get requests.

name
string

The user-friendly name.

2 validations + required
description
string

The user-friendly description.

html
string

An html string containing exactly one script tag. Only present if kind is script_tag

src
string

The src attribute of the script to load. Only present if kind is src.

auto_uninstall
boolean

It will enable automatic cleanup of the script when the single click app is uninstalled or OAuth token is revoked.

load_method
string

The load method to use for the script. Values are default, async, or defer. It determines how the script should be loaded into the page.

1 validation
location
string

Where on the page to place the script. Values are head or footer.

1 validation
visibility
string

Which set of pages the script should load on.

Please note that you need to have Checkout content scope to use all_pages and checkout.

  • The current visibility options are storefront, checkout, all_pages and order_confirmation.

    storefront: All pages that are not checkout or order_confirmation.

For a list of all locations visit Scripts Visibility.

1 validation
kind
string

What type of script this is.

src - a script tag will be generated with its src attribute set to the value of src; For scripts that use the src url. By providing a path to the script, we can optimize and serve the script tag automatically for you.

script_tag - The value of html will be injected directly onto the page. For scripts which include a raw HTML script_tag to be inserted into the page. The load_method must be default.

1 validation
api_client_id
string

The client id of the API user that created this script, or blank if created by other means.

consent_category
string

What category of script this is for the purposes of GDPR/CCPA compliance.

1 validation

Responses

1 Example
Schema
object

For a list of all locations visit Scripts Visibility.

data
object

Script properties common to post, put, and get requests.

1 validation
meta
object

Empty meta object; may be used later.

Send a Test Request

Send requests directly from the browser (CORS must be enabled)
$$.env
2 variables not set
store_hash
X-Auth-Client
X-Auth-Token