Neuen Drucker anlegen
const url = 'https://example.com/api/v1/admin/printers';const options = { method: 'POST', headers: {'X-Label-Hub-Key': '<X-Label-Hub-Key>', 'Content-Type': 'application/json'}, body: '{"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"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”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
Verbindungsparameter für einen Drucker.
Connection of an IPP page printer (spec 11.1): URI and TLS verification (OC-17).
Only ipp, ipps, http and https; no user info, no fragment
(validate_ipp_uri). IPP authentication is out of scope (OC-2).
object
Standard-Schnitteinstellungen für einen Drucker.
object
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
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
How the label content runs on endless tape.
The built-in QL 62 mm across-width layouts (docs/design/ql-layout-presets).
Warteschlangen-Einstellungen für einen Drucker.
object
One tray of a page printer as the admin configures it.
Responses
Section titled “Responses”Successful Response
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
object
object
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
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
How the label content runs on endless tape.
The built-in QL 62 mm across-width layouts (docs/design/ql-layout-presets).
object
A configured tray of a page printer.
Example
{ "layout_defaults": { "additionalProperty": { "orientation": "across", "preset": "compact" } }}Validation Error
object
object
object
Example generated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}