Docs
Content API
Widget Template

Widget Template

Create a Widget Template

POST /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 header
    required

Parameters

  • store_hash in path - string

Body

object | application/json
  • name
    string
    required

    User-friendly name.

  • schema
    array[]

    The schema for the widget’s merchant-facing UI. For more information on the available schema settings, see Widget UI Schema.

  • template
    string
    required

    Handlebars HTML content. Also has access to Stencil Paper helpers.

  • storefront_api_query
    string

    The GraphQL Storefront API query that provides widget data.

  • channel_id
    integer

    The id of the channel on which to create this template. Defaults to the first channel created on the store.

example

Response

Body

object | application/json
  • data

  • meta
    object

    Response metadata.

response

Get All Widget Templates

GET /content/widget-templates

Request

Returns a list of Widget Templates.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string

example

Response

Body

object | application/json
  • data
    array[]

  • meta
    object

    Data about the response, including pagination and collection totals.

response

Render a Widget Template

POST /content/widget-templates/{uuid}/preview

Request

Render a widget template and return the widget html.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string

Body

object | application/json
  • widget_configuration
    object

    The JSON data that populates the template.

example

Response

Success

Body

object | application/json
  • data
    object

example

Get a Widget Template

GET /content/widget-templates/{uuid}

Request

Returns a single Widget Template.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string

example

Response

Body

object | application/json
  • data

  • meta
    object

    Response metadata.

response

Update a Widget Template

PUT /content/widget-templates/{uuid}

Request

Updates a Widget Template.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string

Body

application/json

example

Response

Body

object | application/json
  • data

  • meta
    object

    Response metadata.

response

Delete A Widget Template

DELETE /content/widget-templates/{uuid}

Request

Deletes a Widget Template.

Authentication

  • X-Auth-Token in header
    required

Parameters

  • store_hash in path - string

example

Response

An empty response.

Did you find what you were looking for?