Widgets
Create a Widget Template
POST /stores/{store_hash}/v3/content/widget-templates
Request
Creates a Widget Template.
Note: There is a limit of 1000 custom widget templates per store.
Required Fields
- name
- template
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- Accept in header with default of application/json - stringrequired
The MIME type of the response body.
- Content-Type in header with default of application/json - stringrequired
The MIME type of the request body.
Body
namestring
requiredUser-friendly name.
schemaarray[]
The schema for the widget’s merchant-facing UI. For more information on the available schema settings, see Widget UI Schema.
templatestring
requiredHandlebars HTML content. Also has access to Stencil Paper helpers.
storefront_api_querystring
The GraphQL Storefront API query that provides widget data.
channel_idinteger
The id of the channel on which to create this template. Defaults to the first channel created on the store.
example
Response
Body
data
metaobject
Response metadata.
response
Get All Widget Templates
GET /stores/{store_hash}/v3/content/widget-templates
Request
Returns a list of Widget Templates.
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- page in query - integer
Specifies the page number in a limited (paginated) list of products.
- limit in query - integer
Controls the number of items per page in a limited (paginated) list of products.
- widget_template_kind in query - string
The kind of widget template.
- Accept in header with default of application/json - stringrequired
The MIME type of the response body.
- Content-Type in header with default of application/json - stringrequired
The MIME type of the request body.
- channel_id:in in query - array
A comma-separated list of channel ids to filter the results by.
example
Response
Body
dataarray[object]
metaobject
Data about the response, including pagination and collection totals.
response
Render a Widget Template
POST /stores/{store_hash}/v3/content/widget-templates/{uuid}/preview
Request
Render a widget template and return the widget html.
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- uuid in path - stringrequired
The identifier for a specific widget.
- uuid in path - stringrequired
The identifier for a specific template.
Body
widget_configurationobject
The JSON data that populates the template.
example
Response
Success
Body
data
example
Get a Widget Template
GET /stores/{store_hash}/v3/content/widget-templates/{uuid}
Request
Returns a single Widget Template.
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- version_uuid in query - string
This is an optional query parameter used to fetch a specific widget template version.
example
Response
Body
data
metaobject
Response metadata.
response
Update a Widget Template
PUT /stores/{store_hash}/v3/content/widget-templates/{uuid}
Request
Updates a Widget Template.
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- Content-Type in header with default of application/json - stringrequired
The MIME type of the request body.
Body
namestring
The user-friendly name.
schemaarray[]
The schema for the widget’s merchant-facing UI. For more information on the available schema settings, see Widget UI Schema.
templatestring
The widget template HTML. Supports Handlebars and Paper helpers.
storefront_api_querystring
The GraphQL Storefront API query that provides widget data.
create_new_versionboolean
Can be added to create a new widget template version instead of updating the current one.
channel_idinteger
The id of the channel on which to place this template.
example
Response
Body
data
metaobject
Response metadata.
response
Delete A Widget Template
DELETE /stores/{store_hash}/v3/content/widget-templates/{uuid}
Request
Deletes a Widget Template.
Authentication
- X-Auth-Token in headerrequired
Parameters
- store_hash in path - string
- Accept in header with default of application/json - stringrequired
The MIME type of the response body.
- uuid in path - stringrequired
The identifier for a specific template.
example
Response
An empty response.