Print labels onto sheets
const url = 'https://example.com/api/v1/print/example/sheet';const options = { method: 'POST', headers: {'X-Label-Hub-Key': '<X-Label-Hub-Key>', 'Content-Type': 'application/json'}, body: '{"expected_cells":[{"cells":[1],"id_cell":1,"sheet":"example"}],"items":[{"content_type":"qr_only","data":{"items":[],"primary_id":"example","qr_payload":"example","secondary":[],"title":"example"},"lookup":{"app":"example","identifier":"example"},"purpose":"example","ref":"example","source":"example"}],"placements":[{"cells":"first_free","count":1,"new_sheet":{"id_placement":"cell","type":"example","version":1},"sheet":"example","skip":[1]}],"tray":"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/print/example/sheet \ --header 'Content-Type: application/json' \ --header 'X-Label-Hub-Key: <X-Label-Hub-Key>' \ --data '{ "expected_cells": [ { "cells": [ 1 ], "id_cell": 1, "sheet": "example" } ], "items": [ { "content_type": "qr_only", "data": { "items": [], "primary_id": "example", "qr_payload": "example", "secondary": [], "title": "example" }, "lookup": { "app": "example", "identifier": "example" }, "purpose": "example", "ref": "example", "source": "example" } ], "placements": [ { "cells": "first_free", "count": 1, "new_sheet": { "id_placement": "cell", "type": "example", "version": 1 }, "sheet": "example", "skip": [ 1 ] } ], "tray": "example" }'Reserves the cells for the items and queues one page job per planned page; the cells turn used when a page has printed. Send the preview’s expected_cells to be refused (plan_changed) if the plan moved since. Nothing is reserved if an item fails: a lookup, or a cell that cannot show the item (the error names item_index). A sheet job has no copies. One run prints one sheet: the first items as many as it takes; the response says how many were placed and how many remain (placed, remaining). The response names the job of each page, where its sheet ID and feed-direction mark are printed, and one batch id for all of them.
Authorizations
Abschnitt betitelt „Authorizations“Parameters
Abschnitt betitelt „Parameters“Path Parameters
Abschnitt betitelt „Path Parameters“Printer slug or UUID.
Printer slug or UUID.
Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“object
What a preview promised for one page; the print refuses a different plan.
One label to print: a content type plus raw data or an integration lookup.
purpose is what the cell is recorded as (default: the label’s title, else its primary
id). source names the origin of raw data (default api); a lookup is recorded under
the integration’s name and its identifier as ref.
object
Tape-independent semantic content types for label rendering.
Raw label data of a sheet item: the same fields, every free text bounded.
A page job stores its labels in the job row, and a preview renders them, so the sizes are
capped at the request: qr_payload at 512 characters, every other text at 512, at most
10 secondary lines and 100 items (listing rows). A cell shows far less than that;
the renderer shortens what does not fit. Since #258 the tape RawLabelData carries the
same caps, so this class adds nothing but its name.
object
Resolve label data via an integration plugin.
object
Either an existing sheet (sheet) or a new one (new_sheet), never both.
Items fill the placements in order; the last placement may leave count out and takes
the rest. cells and skip belong to an existing sheet only.
object
first_free, or the cell numbers, in the order the items fill them.
Cells first_free leaves out for this request (never stored).
Responses
Abschnitt betitelt „Responses“Successful Response
The accepted print: one batch of page jobs, one per planned page, in plan order.
object
One page job of a sheet print (the counterpart of PreviewPage).
object
The cells the request’s items take, in item order.
The feed-direction mark is printed on this page.
No margin band is deep enough: no ID on this page.
The sheet ID is printed in a margin band on this page.
Items printed: the first ones of items.
Items left out because one run prints one sheet; print them in another run.
Example
{ "pages": [ { "margin_band": "top" } ]}The key lacks the print scope, or may not use this printer (printer_not_allowed).
Unknown printer (printer_not_found), sheet (sheet_not_found), sheet type, or an item the integration does not have (app-lookup-not-found).
Not a page printer (media_kind_mismatch), the printer is disabled (printer_disabled) or unknown to the print queue (printer-unavailable), the device behind the printer changed (printer-identity-mismatch), the sheet is discarded or archived, the cells do not fit (insufficient_cells, cells_taken), or the plan differs from expected_cells (plan_changed, with the new plan).
Invalid request (invalid_request, field paths only), an unknown or disabled tray (tray_unknown), an item the cell cannot show (content_type_data_mismatch), or an unknown integration (integration_unknown_app). Item errors carry item_index.
An integration lookup failed (integration_lookup_failed), or the print stopped after some pages were queued (print_interrupted, or the error of that page with batch_id and job_ids in error_detail: those pages keep printing).
An integration is not configured (integration_not_configured).