Skip to content

Neuen Drucker anlegen

POST
/api/v1/admin/printers
curl --request POST \
--url https://example.com/api/v1/admin/printers \
--header 'Content-Type: application/json' \
--header 'X-Label-Hub-Key: <X-Label-Hub-Key>' \
--data '{ "backend": "ptouch", "connection": { "host": "example", "port": 1, "snmp": { "community": "public", "discover": false } }, "cut_defaults": { "half_cut": false }, "enabled": true, "layout_defaults": { "additionalProperty": { "orientation": "across", "preset": "compact" } }, "model": "example", "name": "example", "queue": { "timeout_s": 30 }, "slug": "example", "trays": [ { "enabled": true, "is_default": false, "key": "example", "label": "example", "load_hint": "example" } ] }'

Legt einen neuen Drucker an. Slug und Name müssen eindeutig sein. Gibt 409 zurück wenn Slug oder Name bereits vergeben ist. An ipp printer is probed first; nothing is saved when it is unreachable (409 ipp_unreachable), accepts no PDF (409 ipp_pdf_unsupported) or does not report a configured tray (422 tray_unknown). The printer is wired into the running hub before the answer; no restart is needed.

Media typeapplication/json
PrinterCreatePayload

Payload für das Anlegen eines neuen Druckers via Admin-API.

ipp printers take an IppConnection and a required trays list; their model is optional (filled from the probe) and SNMP and cut defaults do not apply. Tape backends keep a required model and must not send trays.

object
backend
required
Backend
string
Allowed values: ptouch brother_ql ipp
connection
required
Connection
Any of:
PrinterConnection

Verbindungsparameter für einen Drucker.

object
host
required
Host
string
>= 1 characters <= 253 characters
port
required
Port
integer
>= 1 <= 65535
snmp
SNMPConfig

Verschachtelt — konsistent mit altem YAML-Schema.

object
community
Community
Any of:
string
<= 64 characters
discover
Discover
boolean
cut_defaults
PrinterCutDefaults

Standard-Schnitteinstellungen für einen Drucker.

object
half_cut
Half Cut
boolean
enabled
Enabled
boolean
default: true
layout_defaults
Layout Defaults

Stored label layout per tape width in mm (#258), used when a print job names none: {“62”: {“orientation”: “across”, “preset”: “compact”}}. across and presets exist for 62 mm only; a missing width uses the tape default (62 mm across/compact, else along). Ignored for page printers.

object
key
additional properties
LayoutDefault

A stored layout default for one tape width of one printer.

None fields fall back to the built-in default for the tape (62 mm: across, compact; every other width: along).

object
orientation
Any of:
LabelOrientation

How the label content runs on endless tape.

string
Allowed values: across along
preset
Any of:
QlLayoutPreset

The built-in QL 62 mm across-width layouts (docs/design/ql-layout-presets).

string
Allowed values: compact small_qr standard
model
Model
Any of:
string
>= 1 characters <= 255 characters
name
required
Name
string
>= 1 characters <= 255 characters
queue
PrinterQueueSettings

Warteschlangen-Einstellungen für einen Drucker.

object
timeout_s
Timeout S
integer
default: 30 >= 1 <= 600
slug
required
Slug
string
/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/
trays
Trays
Any of:
Array<object>
>= 1 items <= 16 items
TrayIn

One tray of a page printer as the admin configures it.

object
enabled
Enabled
boolean
default: true
is_default
Is Default
boolean
key
required
Key
string
/^[a-z0-9][a-z0-9-]{0,63}$/
label
required
Label
string
>= 1 characters <= 60 characters
load_hint
Load Hint
Any of:
string
<= 200 characters

Successful Response

Media typeapplication/json
PrinterRead

Lesbare Darstellung eines Druckers.

Enthält alle DB-Felder — keine internen Implementierungsdetails. trays is the tray list of a page printer and null for tape printers.

object
backend
required
Backend
string
connection
required
Connection
object
key
additional properties
any
created_at
required
Created At
string
cut_defaults
required
Cut Defaults
object
key
additional properties
any
enabled
required
Enabled
boolean
hardware_id
Hardware Id

Serial, IPP printer-uuid or MAC the hub stored for the device; admin only

Any of:
string
hardware_id_kind
Hardware Id Kind

Serial | ipp_uuid | mac

Any of:
string
hardware_id_seen_at
Hardware Id Seen At

When a probe last saw the stored device

Any of:
string
id
required
Id
string format: uuid
layout_defaults
Layout Defaults

Stored label layout per tape width in mm (#258), keyed by the width as a string; a missing width uses the tape default (62 mm across/compact, else along)

object
key
additional properties
LayoutDefault

A stored layout default for one tape width of one printer.

None fields fall back to the built-in default for the tape (62 mm: across, compact; every other width: along).

object
orientation
Any of:
LabelOrientation

How the label content runs on endless tape.

string
Allowed values: across along
preset
Any of:
QlLayoutPreset

The built-in QL 62 mm across-width layouts (docs/design/ql-layout-presets).

string
Allowed values: compact small_qr standard
model
required
Model
string
name
required
Name
string
observed_id
Observed Id

The differing device a flagged swap is about; null otherwise

Any of:
string
observed_kind
Observed Kind

Serial | ipp_uuid | mac

Any of:
string
queue
required
Queue
object
key
additional properties
any
slug
required
Slug
string
trays
Trays
Any of:
Array<object>
TrayRead

A configured tray of a page printer.

object
enabled
required
Enabled
boolean
is_default
required
Is Default
boolean
key
required
Key
string
label
required
Label
string
load_hint
required
Load Hint
Any of:
string
updated_at
required
Updated At
string

Example

{
"layout_defaults": {
"additionalProperty": {
"orientation": "across",
"preset": "compact"
}
}
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string

Example generated

{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}