ScriptTag
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2019-10/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2019-10/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2019-10/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2019-10/script_tags.json Creates a new script tag
- PUT /admin/api/2019-10/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2019-10/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2019-10/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2019-10/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2019-10/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2019-10/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2019-10/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
}
Create a new script tag
POST /admin/api/2019-10/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2019-10/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2019-10/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-01/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2020-01/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2020-01/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2020-01/script_tags.json Creates a new script tag
- PUT /admin/api/2020-01/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2020-01/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2020-01/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2020-01/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2020-01/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2020-01/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2020-01/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
}
Create a new script tag
POST /admin/api/2020-01/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2020-01/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2020-01/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-04/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2020-04/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2020-04/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2020-04/script_tags.json Creates a new script tag
- PUT /admin/api/2020-04/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2020-04/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2020-04/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2020-04/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2020-04/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2020-04/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2020-04/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
}
Create a new script tag
POST /admin/api/2020-04/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2020-04/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2020-04/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-07/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2020-07/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2020-07/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2020-07/script_tags.json Creates a new script tag
- PUT /admin/api/2020-07/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2020-07/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2020-07/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2020-07/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2020-07/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2020-07/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2020-07/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
}
Create a new script tag
POST /admin/api/2020-07/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2020-07/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2020-07/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-10/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2020-10/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2020-10/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2020-10/script_tags.json Creates a new script tag
- PUT /admin/api/2020-10/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2020-10/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2020-10/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2020-10/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2020-10/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2020-10/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2020-10/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
}
Create a new script tag
POST /admin/api/2020-10/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2020-10/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2020-10/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-01/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2021-01/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2021-01/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2021-01/script_tags.json Creates a new script tag
- PUT /admin/api/2021-01/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2021-01/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
cache |
Whether the Shopify CDN can cache and serve the script tag. Valid values:
false .
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2021-01/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2021-01/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2021-01/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2021-01/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2021-01/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all",
"cache": false
}
}
Create a new script tag
POST /admin/api/2021-01/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2021-01/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2021-01/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-04/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2021-04/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2021-04/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2021-04/script_tags.json Creates a new script tag
- PUT /admin/api/2021-04/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2021-04/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
cache |
Whether the Shopify CDN can cache and serve the script tag. Valid values:
false .
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2021-04/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2021-04/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2021-04/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2021-04/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2021-04/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all",
"cache": false
}
}
Create a new script tag
POST /admin/api/2021-04/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2021-04/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2021-04/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-07/script_tags.json Retrieves a list of all script tags
- GET /admin/api/2021-07/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/2021-07/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/2021-07/script_tags.json Creates a new script tag
- PUT /admin/api/2021-07/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/2021-07/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
cache |
Whether the Shopify CDN can cache and serve the script tag. Valid values:
false .
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/2021-07/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/2021-07/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/2021-07/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/2021-07/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/2021-07/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all",
"cache": false
}
}
Create a new script tag
POST /admin/api/2021-07/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/2021-07/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/2021-07/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}
The ScriptTag resource represents remote JavaScript code that is loaded into the pages of a shop's storefront or the order status page of checkout. This lets you add functionality to those pages without using theme templates.
Script tags are scoped to the app that created them. When an app is uninstalled from a shop, all of the script tags that it created are automatically removed along with it.
What you can do with ScriptTag
The Shopify API lets you do the following with the ScriptTag resource. More detailed versions of these general actions may be available:
- GET /admin/api/unstable/script_tags.json Retrieves a list of all script tags
- GET /admin/api/unstable/script_tags/count.json Retrieves a count of all script tags
- GET /admin/api/unstable/script_tags/{script_tag_id}.json Retrieves a single script tag
- POST /admin/api/unstable/script_tags.json Creates a new script tag
- PUT /admin/api/unstable/script_tags/{script_tag_id}.json Updates a script tag
- DELETE /admin/api/unstable/script_tags/{script_tag_id}.json Deletes a script tag
ScriptTag properties
created_at
read-only |
The date and time (ISO 8601) when the script tag was created. |
event
required |
The DOM event that triggers the loading of the script. Valid values: |
id
read-only |
The ID for the script tag. |
src
required |
The URL of the remote script. |
display_scope |
The page or pages on the online store where the script should be included. Valid values:
|
cache |
Whether the Shopify CDN can cache and serve the script tag. Valid values:
false .
|
updated_at
read-only |
The date and time (ISO 8601) when the script tag was last updated. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
limit
|
The number of results to return. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
created_at_min
|
Show script tags created after this date. (format: 2014-04-25T16:15:47-04:00) |
created_at_max
|
Show script tags created before this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_min
|
Show script tags last updated after this date. (format: 2014-04-25T16:15:47-04:00) |
updated_at_max
|
Show script tags last updated before this date. (format: 2014-04-25T16:15:47-04:00) |
src
|
Show script tags with this URL. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a list of all script tags
GET /admin/api/unstable/script_tags.json
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 421379493,
"src": "https://js-aplenty.com/bar.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
},
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags with a particular URL
GET /admin/api/unstable/script_tags.json?src=https://js-aplenty.com/foo.js
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
Retrieve a list of all script tags after the specified ID
GET /admin/api/unstable/script_tags.json?since_id=421379493
View Response
HTTP/1.1 200 OK
{
"script_tags": [
{
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all"
}
]
}
src
|
Count only script tags with a given URL. |
Retrieve a count of all script tags for your shop
GET /admin/api/unstable/script_tags/count.json
View Response
HTTP/1.1 200 OK
{
"count": 2
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve a single script tag by its ID
GET /admin/api/unstable/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://js-aplenty.com/foo.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:38:36-04:00",
"display_scope": "all",
"cache": false
}
}
Create a new script tag
POST /admin/api/unstable/script_tags.json
{
"script_tag": {
"event": "onload",
"src": "https://djavaskripped.org/fancy.js"
}
}
View Response
HTTP/1.1 201 Created
{
"script_tag": {
"id": 870402687,
"src": "https://djavaskripped.org/fancy.js",
"event": "onload",
"created_at": "2021-04-01T14:48:13-04:00",
"updated_at": "2021-04-01T14:48:13-04:00",
"display_scope": "all",
"cache": false
}
}
Creating a script tag without a src and event will return an error
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"src": [
"can't be blank",
"must be secure (HTTPS)"
],
"event": [
"can't be blank",
"is invalid"
]
}
}
Update a script tag's URL
PUT /admin/api/unstable/script_tags/596726825.json
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js"
}
}
View Response
HTTP/1.1 200 OK
{
"script_tag": {
"id": 596726825,
"src": "https://somewhere-else.com/another.js",
"event": "onload",
"created_at": "2021-04-01T14:38:36-04:00",
"updated_at": "2021-04-01T14:48:15-04:00",
"display_scope": "all",
"cache": false
}
}
Delete an existing script tag
DELETE /admin/api/unstable/script_tags/596726825.json
View Response
HTTP/1.1 200 OK
{
}