Concepts
Response templates
Tokens filled from the request, the path, the collection, and the clock.
Set the behavior to Template, or put tokens in a stateful route's body. A token is {{name}} or {{name.field}}. Unknown names become an empty string. Objects and arrays are inserted as JSON, so a body that is only {{item}} is the record itself.
- {{param.id}} {{query.q}} {{header.x-request-id}} {{body.sku}} {{body}}
- {{req.method}} {{req.path}}
- {{uuid}} {{now}} {{unix}}
- {{item}} {{item.sku}} {{items}}
- {{state.collections.orders}}
{{item}} and {{items}} are set for a stateful route after the read or write. {{state}} is the twin's state document. An empty stateful body returns the stored JSON instead of a template. There is no helper library for random names, JWT signing, or XML queries.