103 lines
1.9 KiB
Markdown
103 lines
1.9 KiB
Markdown
# `PUT /labeltemplate/{id}`
|
|
|
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
|
|
|
Update label template
|
|
|
|
Replaces an existing label template.
|
|
When `content` (or `width`/`height`) is provided, the thumbnail is automatically re-rendered.
|
|
|
|
|
|
## Path parameters
|
|
|
|
| Param | Required | Type | Description |
|
|
|-------|----------|------|-------------|
|
|
| `id` | yes | integer | Label template ID |
|
|
|
|
## Body (JSON)
|
|
|
|
| Field | Required | Type | Description |
|
|
|-------|----------|------|-------------|
|
|
| `name` | no | string | |
|
|
| `width` | no | number | |
|
|
| `height` | no | number | |
|
|
| `dpi` | no | integer | |
|
|
| `type` | no | string | |
|
|
| `content` | no | 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 `200`
|
|
|
|
Updated 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 — `{"error":"…"}` |
|
|
| 401 | Unauthorized — `{"error":"…"}` |
|
|
| 404 | Label template not found — `{"error":"…"}` |
|
|
|
|
---
|
|
|
|
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|