66 lines
1.4 KiB
Markdown
66 lines
1.4 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)
|
||
|
||
```json
|
||
{
|
||
"name": "…",
|
||
"width": 448,
|
||
"height": 200,
|
||
"dpi": 203,
|
||
"type": "zpl",
|
||
"content": {
|
||
"objects": []
|
||
}
|
||
}
|
||
```
|
||
|
||
| Field | Required | Type | Description |
|
||
|-------|----------|------|-------------|
|
||
| `name` | yes | string | Template name |
|
||
| `width` | yes | integer | Canvas width in pixels |
|
||
| `height` | yes | integer | Canvas height in pixels |
|
||
| `dpi` | yes | integer | Printer DPI — `203` or `300` |
|
||
| `type` | yes | string | Template type — `"zpl"` |
|
||
| `content` | yes | object | Label editor JSON content |
|
||
|
||
## Response `201`
|
||
|
||
Created label template
|
||
|
||
```json
|
||
{
|
||
"labeltemplate": {
|
||
"id": 1,
|
||
"company_id": 1,
|
||
"name": "…",
|
||
"width": 448,
|
||
"height": 200,
|
||
"dpi": 203,
|
||
"type": "zpl",
|
||
"content": {},
|
||
"thumb": "…"
|
||
}
|
||
}
|
||
```
|
||
|
||
`thumb` is a base64-encoded 50×50 1-bit PNG string, or `null` if rendering failed.
|
||
|
||
## 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`._
|