Files
dashback/docs/api/routes/zpljob.md
2026-11-01 03:33:14 +01:00

57 lines
1.3 KiB
Markdown

# `POST /zpljob`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create ZPL print job
Issues a new ZPL print job to an agent printer. If copiescount > 1, the ZPL quantity command (^PQ)
is automatically applied. The connected printer agent receives an immediate real-time event.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `agentprinterId` | yes | integer | Target agent printer ID |
| `copiescount` | no | integer | Optional copy count (defaults to 1) |
| `data` | yes | string | Raw ZPL string |
```json
{
"agentprinterId": 1,
"copiescount": 2,
"data": "^XA^FO50,50^ADN,36,20^FDHello Zebra^FS^XZ"
}
```
## Response `201`
Print job created
```json
{
"printerjob": {
"id": 1,
"agentprinterId": 1,
"printeragentId": 1,
"type": "zpl",
"state": "pending",
"data": "…",
"createdAt": "2026-08-10T00:00:00.000Z",
"completedAt": "2026-08-10T00:00:00.000Z"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 404 | Agent printer not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._