97 lines
1.8 KiB
Markdown
97 lines
1.8 KiB
Markdown
# `POST /labeltemplate`
|
||
|
||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||
|
||
Create label template
|
||
|
||
Creates a new ZPL label template for the selected company.
|
||
A 50×50 1-bit PNG thumbnail is automatically rendered from the content
|
||
and stored with the template.
|
||
|
||
|
||
## Body (JSON)
|
||
|
||
| Field | Required | Type | Description |
|
||
|-------|----------|------|-------------|
|
||
| `name` | yes | string | |
|
||
| `width` | yes | number | |
|
||
| `height` | yes | number | |
|
||
| `dpi` | yes | integer | |
|
||
| `type` | yes | string | |
|
||
| `content` | yes | LabelContent | |
|
||
|
||
```json
|
||
{
|
||
"name": "…",
|
||
"width": 1,
|
||
"height": 1,
|
||
"dpi": 1,
|
||
"type": "…",
|
||
"content": {
|
||
"objects": [
|
||
{
|
||
"id": "…",
|
||
"type": "textbox",
|
||
"x": 1,
|
||
"y": 1,
|
||
"w": 1,
|
||
"h": 1,
|
||
"text": "…",
|
||
"font": "…",
|
||
"fontSize": 1,
|
||
"barcodeFormat": "EAN8"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
## Signals
|
||
|
||
On success, emits SSE signal: `labeltemplate` (see [`GET /events`](../events.md)).
|
||
|
||
## Response `201`
|
||
|
||
Created label template
|
||
|
||
```json
|
||
{
|
||
"labeltemplate": {
|
||
"id": 1,
|
||
"name": "…",
|
||
"width": 1,
|
||
"height": 1,
|
||
"dpi": 1,
|
||
"type": "…",
|
||
"content": {
|
||
"objects": [
|
||
{
|
||
"id": "…",
|
||
"type": "textbox",
|
||
"x": 1,
|
||
"y": 1,
|
||
"w": 1,
|
||
"h": 1,
|
||
"text": "…",
|
||
"font": "…",
|
||
"fontSize": 1,
|
||
"barcodeFormat": "EAN8"
|
||
}
|
||
]
|
||
},
|
||
"thumb": "…"
|
||
}
|
||
}
|
||
```
|
||
|
||
## Errors
|
||
|
||
| Status | Description |
|
||
|--------|-------------|
|
||
| 400 | Invalid input or missing fields — `{"error":"…"}` |
|
||
| 401 | Unauthorized — `{"error":"…"}` |
|
||
|
||
---
|
||
|
||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|