Files
dashback/docs/api/routes/printer/create.md
2026-10-09 19:02:15 +02:00

67 lines
1.3 KiB
Markdown

# `POST /printer`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create printer
Creates a new printer for the selected company.
`type` must be `"esc/pos"` (lines), `"zpl"` (pages), or `"ipp"`.
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `address` | yes | string | Printer network address or hostname |
| `type` | yes | string | Printer type ("esc/pos" for lines, "zpl" for pages, or "ipp") |
| `model` | no | string | |
| `serial` | no | string | |
| `sort` | no | integer | |
| `desc` | no | string | |
```json
{
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
```
## Signals
On success, emits SSE signal: `printer` (see [`GET /events`](../events.md)).
## Response `201`
Created printer
```json
{
"printer": {
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._