Templates

See Templates for working copy vs publish, schema, and workflow. Get the museum id from listMuseums first.

Every tool that changes a template is checked before anything is saved: against the template as it is now and against what its kind can hold (getTemplateSchema). A call saves all of what it was given or nothing. When a change does not fit, the tool answers Not saved, then one line per problem: which part of what you sent, what is wrong, and what would be right. See Every change is checked.

listTemplates

List every template of a museum. Optionally filter by type (the type string from getTemplateSchema).

ArgumentTypeRequiredDescription
museumIdstringYesMuseum id from listMuseums
typestringNoTemplate type string from getTemplateSchema

getTemplate

Get one template and its working copy (the draft tree of nodes). Look this up before you change anything.

ArgumentTypeRequiredDescription
idstringYesTemplate id

createTemplate

Create a new template. Pass museumId and a type from getTemplateSchema; a type that is not a kind of template is turned down with the list of kinds. A receipt (the PDF, its email, the one a cash register prints), a price tag, a printed ticket, a voucher and a booking start as a copy of Loby's own for that kind, so read what comes back before you add to it; the other kinds start empty. It is a working copy: guests see it once someone publishes it in Loby Cloud and, where a museum has one in use per kind (getTemplateAssignments), picks it there.

ArgumentTypeRequiredDescription
museumIdstringYesMuseum id
typestringYesTemplate type string from getTemplateSchema
namestringNoName of the template

renameTemplate

Change the name of a template. Does not change the working copy.

ArgumentTypeRequiredDescription
idstringYesTemplate id
namestringYesNew name

deleteTemplate

Remove a template. Guests keep seeing the last published version until a replacement is published.

ArgumentTypeRequiredDescription
idstringYesTemplate id

insertTemplateNodes

Add one or many nodes in a single change; use it for a whole block. Each node needs a type this kind of template can hold, with the props and styles that type has there (getTemplateSchema). LAYER and other groups may hold children. All of the nodes are saved or none.

ArgumentTypeRequiredDescription
templateIdstringYesTemplate id
nodesarrayYesList of nodes: [{ type, props, styles, children }]. styles may be one flat object, { fontSize: 13 }. A TEXT may be written { type: "TEXT", text: "Tak for besøget", language: "da" }; without language the text is in the museum's default language. Leave id out: each node gets one.
parentIdstringNoId of the node to add them inside; it has to be one that holds nodes, like a LAYER. Omit or pass null for the top level.
indexintegerNoPlace among the parent's nodes, counted from 0. Omit to add at the end.

Returns the nodes as they are stored (nodes), their ids (insertedNodeIds), parentId and the template's nodeCount. It does not return the whole working copy; call getTemplate for that.

updateTemplateNode

Change one node. Only what you pass changes: props, styles, the text of a TEXT in one language, the name shown in the designer, or whether the node is hidden. All of it is saved or none.

ArgumentTypeRequiredDescription
templateIdstringYesTemplate id
nodeIdstringYesId of the node, from getTemplate
propsobjectNoObject of props to set, for example { url: "https://…" }. null on a key clears it.
stylesobjectNoObject of styles to set, for example { fontSize: 13 }. null on a key clears it. The names are the ones this kind of template has (getTemplateSchema), not CSS.
elementStylesarrayNoList of { element, propertyName, propertyValue, stylesKey } for checkout and rich text.
textstringNoThe text of a TEXT node in one language. Its other languages keep their text: change each one the wording should change in. An empty text removes that language.
languagestringNoThe language text is written in, two letters. Defaults to the museum's default language (masterLanguage on listMuseums).
namestringNoDisplay name in the tree
hidebooleanNoHide or show the node

Returns the node as it is stored now (node), its parentId and the template's nodeCount.

An older text can be a plain text, or hold value beside its translations: the words it shows in every language it has no translation for. The first time text changes such a node it becomes one text per language, with those words as the default language's.

removeTemplateNode

Remove one node and everything inside it.

ArgumentTypeRequiredDescription
templateIdstringYesTemplate id
nodeIdstringYesNode id

moveTemplateNode

Move one node next to or inside another. placement is INSIDE, ABOVE, or BELOW. INSIDE needs a target that holds nodes, and a node cannot be moved into itself. Returns where the node sits now (parentId, index).

ArgumentTypeRequiredDescription
templateIdstringYesTemplate id
nodeIdstringYesNode to move
targetIdstringYesNode to move relative to
placementstringYesINSIDE, ABOVE, or BELOW

setTemplateOption

Change an option of the whole template (an email's subject and background colour, a pass's images and colours, a label's size, an app's content roots, default styles and intro). The options a kind has, with what each takes, are in getTemplateSchema; another option is turned down. Returns the template's options as they are stored now.

ArgumentTypeRequiredDescription
templateIdstringYesTemplate id
pathstringYesName of the option, from getTemplateSchema: for example subject, backgroundColor or labelWidth
valueanyNoNew value. Omit or pass null to clear.
languagestringNoThe language a subject is written in, two letters. Defaults to the museum's default language.

getTemplateSchema

What a kind of template can hold: its node types with their props, the styles each has there, its options, the values it is drawn from (variables), and what a condition can test on it (conditions). A change that uses anything else is turned down. Pass a type for one kind, or a category (email, print, wallet, seating, thermal, mobile, website, checkout, selfService, customerScreen, receiptPrinter, labelPrinter, ticketPrinter). With neither, lists kinds.

ArgumentTypeRequiredDescription
typestringNoTemplate type string, for example from listTemplates
categorystringNoemail, print, wallet, seating, thermal, mobile, website, checkout, selfService, customerScreen, receiptPrinter, labelPrinter, or ticketPrinter

getTemplateAssignments

See which default emails, PDFs, passes, thermal slips, checkout styling and customer screen welcome screen a museum uses, and under overrides the items that chose their own instead: booking types and things (the booking PDF and email; a thing's own wins over its type's, which wins over the museum's), ticket types and voucher products (their PDF), and locations (their ticket receipt email). Events and their ticket types choose theirs on each event and are not listed. Read-only.

ArgumentTypeRequiredDescription
museumIdstringYesMuseum id
‹ Previous
Levels, Entries, Capacities
Next ›
Content, Fonts, Photos