v1

latestSwagger 2.02026-07-17148179252.3 KB
Script

Updates a script.

put/content/scripts/{uuid}

Path parameters

uuidstring uuid required

The identifier for a specific script.

Request body

namestring

The user-friendly name.

descriptionstring

The user-friendly description.

htmlstring

An html string containing exactly one script tag. Required if kind is included and equal to script_tag.

srcstring

The src attribute of the script to load. Required if kind is included and equal to src. Must be in https format.

auto_uninstallboolean

Whether to uninstall this script when the app associated with it is removed.

load_method'default' | 'async' | 'defer'

The load method to use for the script. Acceptable values are default, async, or defer.

location'head' | 'footer'

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

visibility'storefront' | 'all_pages' | 'checkout' | 'order_confirmation'

Which set of pages the script should load on. The values allowed for this parameter are storefront, all_pages, checkout and order_confirmation. Please note that you need to have Checkout content scope to use all_pages and checkout.

kind'src' | 'html'

What type of script this is. Acceptable values are src - a script tag will be generated with its src attribute set to the value of src; script_tag - The value of html (which must contain a single script tag) will be injected directly onto the page.

Example request

{
  "name": "jQuery",
  "description": "The Write Less, Do More, JavaScript Library.",
  "src": "https://code.jquery.com/jquery-3.2.1.min.js",
  "auto_uninstall": true,
  "load_method": "defer",
  "location": "head",
  "visibility": "storefront",
  "kind": "src"
}

Response

Success

Example response

{
  "data": {
    "uuid": "2bf40be2-e57a-4bc8-860a-5bf45edd3795",
    "name": "jQuery",
    "description": "The Write Less, Do More, JavaScript Library.",
    "src": "https://code.jquery.com/jquery-3.2.1.min.js",
    "auto_uninstall": true,
    "load_method": "defer",
    "location": "head",
    "visibility": "storefront",
    "kind": "src",
    "api_client_id": "d1j42k5q76xsm15fa3g8sp2egytoixo",
    "date_created": "2017-12-05T23:37:45.506Z",
    "date_modified": "2017-12-05T23:37:45.506Z"
  }
}