Skip to navigation

Plan: Stencil Developer

Lesson 9 of 23 · 15 min

In this lab you will

  • Create a widget template using Postman

Prerequisites

  • BC Sandbox
  • API credentials for the store (Content: Modify)
  • Postman installed
  • Widgets API collection

Create a Widget Template

Create a widget template using Postman

  1. Navigate to the ‘Widget Templates’ folder in the ‘Widgets API Labs’ collection in the ‘Collections’ pane on the left side of the Postman window
  2. Click the ‘Create Widget Template’ post request
  3. Select the ‘Body’ tab in the main content window in Postman
  4. Confirm the content in the body is the following:
{
"name": "Hello World Template",
"template": "<div class=\"hello-world\">\n<h2>Hello, World!</h2>\n<p>This is my first widget template.</p>\n</div>",
"schema": []
}

Templates are submitted in JSON format. When creating your own templates, make sure your HTML, CSS, and JavaScript are properly escaped.

  1. Click the ‘Send’ button at the top right of the Postman window
  2. Observe the Widget Template UUID in the response section at the bottom of the Postman window. The request saves it to the widget_template_uuid environment variable for later requests

This template has no schema settings and no Handlebars variables — it renders the same static markup every time. Later modules build on this by adding schema settings and Handlebars variables to make a widget template’s content configurable.