Templates
See Templates for working copy vs publish, schema, and workflow. Get the museum id from listMuseums first.
listTemplates
List every template of a museum. Optionally filter by type (the type string from getTemplateSchema).
| Argument | Type | Required | Description |
|---|---|---|---|
museumId | string | Yes | Museum id from listMuseums |
type | string | No | Template type string from getTemplateSchema |
getTemplate
Get one template and its working copy (the draft tree of nodes). Look this up before you change anything.
| Argument | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Template id |
createTemplate
Create a new empty template. Pass museumId and a type from getTemplateSchema. Starts as a working copy; it does not go live until someone publishes in the product.
| Argument | Type | Required | Description |
|---|---|---|---|
museumId | string | Yes | Museum id |
type | string | Yes | Template type string from getTemplateSchema |
name | string | No | Name of the template |
renameTemplate
Change the name of a template. Does not change the working copy.
| Argument | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Template id |
name | string | Yes | New name |
deleteTemplate
Remove a template. Guests keep seeing the last published version until a replacement is published.
| Argument | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Template id |
insertTemplateNodes
Insert one or many nodes in a single change. Use this for a whole block. Open getTemplateSchema first so you use allowed types and props. LAYER and other groups may include children.
| Argument | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template id |
nodes | array | Yes | List of nodes to insert. Each needs a type. Groups may include children. TEXT may include text and language. |
parentId | string | No | Parent node id. Omit or pass null to insert at the root. |
index | integer | No | Position among siblings. Omit to append. |
Returns the working copy plus insertedNodeIds.
updateTemplateNode
Change one node. Only the fields you pass change. Use props for node props, styles for style keys, text for translations, name, or hide.
| Argument | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template id |
nodeId | string | Yes | Node id |
props | object | No | Object of prop keys to set. Pass null on a key to clear it. |
styles | object | No | Object of style keys to set on the node definition. |
elementStyles | array | No | List of { element, propertyName, propertyValue, stylesKey } for checkout and rich text. |
text | string | No | Text for a TEXT node |
language | string | No | Language for text. Defaults to en. |
name | string | No | Display name in the tree |
hide | boolean | No | Hide or show the node |
removeTemplateNode
Remove one node, including its children.
| Argument | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template id |
nodeId | string | Yes | Node id |
moveTemplateNode
Move one node next to or inside another. placement is INSIDE, ABOVE, or BELOW.
| Argument | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template id |
nodeId | string | Yes | Node to move |
targetId | string | Yes | Node to move relative to |
placement | string | Yes | INSIDE, ABOVE, or BELOW |
setTemplateOption
Change a template-level option (subject, background color, pass images, content roots, default styles, app intro). Path names come from getTemplateSchema. For an email subject, pass language too.
| Argument | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | Template id |
path | string | Yes | Option path from getTemplateSchema, for example subject or backgroundColor or contentRoots |
value | any | No | New value. Omit or pass null to clear. |
language | string | No | Language when path is subject |
getTemplateSchema
Node types, props, styles, and options for templates. Pass a type for one kind, or a category (email, print, wallet, seating, thermal, mobile, website, checkout). With neither, lists kinds.
| Argument | Type | Required | Description |
|---|---|---|---|
type | string | No | Template type string, for example from listTemplates |
category | string | No | email, print, wallet, seating, thermal, mobile, website, or checkout |
getTemplateAssignments
See which default emails, PDFs, passes, thermal slips, and checkout styling a museum uses. Read-only.
| Argument | Type | Required | Description |
|---|---|---|---|
museumId | string | Yes | Museum id |