Zum Inhalt springen

Print labels onto sheets

POST
/api/v1/print/{printer_key}/sheet
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.

printer_key
required
Printer Key

Printer slug or UUID.

string
<= 100 characters

Printer slug or UUID.

Media typeapplication/json
SheetPrintRequest
object
expected_cells
Expected Cells
Any of:
Array<object>
<= 50 items
ExpectedPageModel

What a preview promised for one page; the print refuses a different plan.

object
cells
required
Cells
Array<integer>
<= 400 items
id_cell
Id Cell
Any of:
integer
>= 1 <= 400
sheet
required
Sheet

Sheet code, or new.

string
<= 24 characters
items
required
Items
Array<object>
>= 1 items <= 500 items
SheetItem

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
content_type
required
ContentType

Tape-independent semantic content types for label rendering.

string
Allowed values: qr_only qr_one_line qr_two_lines qr_three_lines text_one_line text_two_lines qr_with_listing
data
Any of:
SheetRawLabelData

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
items
Items
Array<object>
default: <= 100 items
RawListingItem

One listing row of raw label data, with bounded text.

object
item
required
Item
string
<= 512 characters
qr_payload
Qr Payload
Any of:
string
<= 512 characters
primary_id
Primary Id
Any of:
string
<= 512 characters
qr_payload
Qr Payload
Any of:
string
<= 512 characters
secondary
Secondary
Array<string>
default: <= 10 items
title
Title
Any of:
string
<= 512 characters
lookup
Any of:
PrintLookupRequest

Resolve label data via an integration plugin.

object
app
required
App
string
identifier
required
Identifier
string
purpose
Purpose
Any of:
string
<= 120 characters
ref
Ref
Any of:
string
<= 120 characters
source
Source
Any of:
string
/^[a-z][a-z0-9_-]{0,31}$/
placements
required
Placements
Array<object>
>= 1 items <= 50 items
PlacementInModel

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
cells
Cells

first_free, or the cell numbers, in the order the items fill them.

Any of:
string
Allowed value: first_free
count
Count
Any of:
integer
>= 1 <= 500
new_sheet
Any of:
NewSheetModel
object
id_placement
Id Placement

Where the sheet ID is printed; margin if left out.

string
default: margin
Allowed values: cell margin manual
type
required
Type

Sheet type key.

string
<= 64 characters /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/
version
Version

Defaults to the current version.

Any of:
integer
>= 1 <= 1000000
sheet
Sheet

Sheet code.

Any of:
string
<= 24 characters
skip
Skip

Cells first_free leaves out for this request (never stored).

Array<integer>
<= 400 items
tray
Tray
Any of:
string
>= 1 characters <= 100 characters

Successful Response

Media typeapplication/json
SheetPrintResponse

The accepted print: one batch of page jobs, one per planned page, in plan order.

object
batch_id
required
Batch Id
string format: uuid
pages
required
Pages
Array<object>
PrintedPage

One page job of a sheet print (the counterpart of PreviewPage).

object
cells
required
Cells

The cells the request’s items take, in item order.

Array<integer>
feed_mark
required
Feed Mark

The feed-direction mark is printed on this page.

boolean
id_cell
required
Id Cell

The cell of a cell sheet’s ID label, if any.

Any of:
integer
id_not_printed
required
Id Not Printed

No margin band is deep enough: no ID on this page.

boolean
job_id
required
Job Id
string format: uuid
margin_band
required
Margin Band

The band stored for this job; it can differ from the preview’s.

Any of:
string
Allowed values: top bottom right left
margin_id
required
Margin Id

The sheet ID is printed in a margin band on this page.

boolean
sheet_code
required
Sheet Code
string
placed
required
Placed

Items printed: the first ones of items.

integer
remaining
required
Remaining

Items left out because one run prints one sheet; print them in another run.

integer

Example

{
"pages": [
{
"margin_band": "top"
}
]
}

The key lacks the print scope, or may not use this printer (printer_not_allowed).

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}

Unknown printer (printer_not_found), sheet (sheet_not_found), sheet type, or an item the integration does not have (app-lookup-not-found).

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}

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).

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}

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.

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}

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).

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}

An integration is not configured (integration_not_configured).

Media typeapplication/json
object
detail
required
object
error_code
required
string
error_detail
Any of:
object
key
additional properties
any
error_message
required
string

Example generated

{
"detail": {
"error_code": "example",
"error_detail": {},
"error_message": "example"
}
}