TicketTemplates
Ticket Template Managementβ
Endpoints for managing the ticket templates used for printing.
All template endpoints require only a valid accessToken (auth-jwt); they do not use granular permissions.
GET /templatesβ
Retrieves all available ticket templates.
Authorization: valid accessToken.
cURL Example:
curl -X GET "http://127.0.0.1:9154/templates" \
-H "Cookie: accessToken=$ACCESS_TOKEN"
Response Body (200 OK):
[
{
"id": "template-uuid",
"name": "Default Customer Ticket",
"elements": []
}
]
GET /templates/{id}β
Retrieves a ticket template by its ID.
Authorization: valid accessToken.
Path Parameters:
id(string): ID of the template to retrieve.
cURL Example:
curl -X GET "http://127.0.0.1:9154/templates/template-uuid" \
-H "Cookie: accessToken=$ACCESS_TOKEN"
Response Body (200 OK):
{
"id": "template-uuid",
"name": "Default Customer Ticket",
"elements": []
}
Response: 404 Not Found if the template does not exist.
POST /templatesβ
Creates a new ticket template.
Authorization: valid accessToken.
Request Body:
{
"name": "string",
"elements": [
{
"type": "HEADER",
"value": "{{config.businessName}}",
"style": { "bold": true, "justification": "CENTER", "fontSize": "NORMAL" }
}
]
}
cURL Example:
curl -X POST "http://127.0.0.1:9154/templates" \
-H "Cookie: accessToken=$ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Custom Template",
"elements": [
{
"type": "HEADER",
"value": "{{config.businessName}}",
"style": { "bold": true, "justification": "CENTER" }
}
]
}'
Response Body (201 Created):
{ "id": "new-template-uuid" }
Response Body (409 Conflict): duplicate template name.
{ "error": "Template name already exists" }
PUT /templates/{id}β
Updates an existing template.
Authorization: valid accessToken.
Path Parameters:
id(string): ID of the template to update.
Request Body: same as creation.
Response Body (200 OK): successful update.
Response Body (409 Conflict): the template does not exist or the name is already taken.
{ "error": "Failed to update template. It might not exist or the name is already taken." }
DELETE /templates/{id}β
Deletes a ticket template.
Authorization: valid accessToken.
Path Parameters:
id(string): ID of the template to delete.
Response: 204 No Content if deleted; 404 Not Found if it does not exist.
Notesβ
The details of the TicketTemplate, TicketElement, ElementType, etc. models are in Models.