Zum Inhalt springen

Drucker aktualisieren

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

Aktualisiert einen Drucker per PATCH-Semantik (nur geänderte Felder). Slug und ID können nicht geändert werden. Gibt 404 zurück wenn kein Drucker mit diesem Slug existiert. connection must fit the stored backend (422 invalid_connection); trays (replace-all) are for ipp printers only (422 trays_not_allowed). An ipp printer is probed again when its URI changes or a tray key is new. A change of the connection, the trays or the IPP queue timeout re-wires the printer before the answer: a job printing on it finishes first (up to its queue timeout), waiting jobs stay queued. A rename re-wires nothing.

slug
required
Slug
string
Media typeapplication/json
PrinterUpdatePayload

Payload für das Aktualisieren eines bestehenden Druckers via Admin-API.

Der Service ignoriert stillschweigend: slug, model, backend, id. Alle Felder sind optional — ein leerer Body ist ein gültiger PATCH.

The payload carries no backend, so the service checks connection against the stored row’s backend; trays (replace-all) are for ipp printers only.

object
connection
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
Any of:
PrinterCutDefaults

Standard-Schnitteinstellungen für einen Drucker.

object
half_cut
Half Cut
boolean
enabled
Enabled
Any of:
boolean
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. Replaces the stored set.

Any of:
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
name
Name
Any of:
string
>= 1 characters <= 255 characters
queue
Any of:
PrinterQueueSettings

Warteschlangen-Einstellungen für einen Drucker.

object
timeout_s
Timeout S
integer
default: 30 >= 1 <= 600
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"
}
]
}