Zum Inhalt springen

Get Batch

GET
/api/v1/batches/{batch_id}
curl --request GET \
--url https://example.com/api/v1/batches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'X-Label-Hub-Key: <X-Label-Hub-Key>'

Snapshot eines Batches + aller aktuellen Job-States.

Wird von Hangar’s /admin/print/result/{batch_id} für das initiale Rendering genutzt. summary.all_terminal == False bedeutet, dass Hangar den JSON-Stream /api/v1/events verfolgen sollte für Live-Updates. run shows a tape run that prints, waits for a confirmation, or stopped (#277).

batch_id
required
Batch Id
string format: uuid

Successful Response

Media typeapplication/json
BatchRead
object
created_at
required
Created At
string
created_by
required
Created By
Any of:
string
id
required
Id
string format: uuid
jobs
required
Jobs
Array<object>
JobRead

Serialised view of a Job DB row.

object
created_at
required
Created At
string
error
required
Error
Any of:
string
finished_at
required
Finished At
Any of:
string
id
required
Id
string format: uuid
payload
required
Payload
object
key
additional properties
any
printer_id
required
Printer Id
string format: uuid
result
required
Result
Any of:
object
key
additional properties
any
started_at
required
Started At
Any of:
string
state
required
State
string
template_key
required
Template Key
Any of:
string
updated_at
required
Updated At
string
printer_id
required
Printer Id
string format: uuid
run

The tape run while it has something to show (#277).

Any of:
TapeRunRead

A tape batch that is printing, waits for a confirmation, or stopped (#277).

Positions are 1-based in print order (job_ids).

object
batch_id
required
Batch Id
string format: uuid
confirmed_job_ids
required
Confirmed Job Ids

Labels of an unknown group the user confirmed as printed (a reprint).

Array<string>
current_sub_job
required
Current Sub Job

The sub-job printing or waiting, 1-based.

integer
job_ids
required
Job Ids

The job of every label, in print order.

Array<string>
printer_id
required
Printer Id
string format: uuid
reprint_from
required
Reprint From

Lowest from_label a reprint accepts.

Any of:
integer
reprint_to
required
Reprint To

Highest from_label: one past the unknown group (only the not-started).

Any of:
integer
state
required
State

awaiting_confirmation: the next sub-job starts after POST .../continue. stopped: a group failed; the labels after it were not started. With stop_kind unknown the group’s outcome is unknown (an error while sending, or the status check after the group: on a PT the SNMP noPaper bit at tape end; whether a QL-820NWB reports a DK roll end is not verified); with refused the printer refused before anything was sent (wrong tape, no tape, cover open, unreachable). POST .../reprint picks it up, POST .../discard gives it up. Held runs are kept in memory: a hub restart fails every label that waited for a confirmation (tape_run_interrupted), and a stopped run cannot be reprinted after it.

string
Allowed values: printing awaiting_confirmation stopped
stop_code
required
Stop Code

Why the run stopped, e.g. tape_empty.

Any of:
string
stop_kind
required
Stop Kind

After a stop: the group’s outcome is unknown, or nothing of it was sent.

Any of:
string
Allowed values: unknown refused
sub_job_size
required
Sub Job Size
integer
sub_job_starts
required
Sub Job Starts

Where each sub-job starts in job_ids (0-based); a reprint re-splits.

Array<integer>
sub_jobs
required
Sub Jobs
integer
unknown_from
required
Unknown From

First label of the unknown group.

Any of:
integer
unknown_to
required
Unknown To

Last label of the unknown group.

Any of:
integer
summary
required
BatchSummary

Aggregierte Zähler über alle Jobs eines Batches.

all_terminal wird aus queued + printing berechnet — kein DB-Round-trip nötig. Hangar’s Result-Page nutzt all_terminal um zu entscheiden, ob ein SSE-Stream für Live-Updates geöffnet werden muss.

object
all_terminal
All Terminal
boolean
cancelled
required
Cancelled
integer
done
required
Done
integer
failed
required
Failed
integer
printing
required
Printing
integer
queued
required
Queued
integer
total
required
Total
integer

Example

{
"run": {
"state": "printing",
"stop_kind": "unknown"
},
"summary": {
"all_terminal": false
}
}

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"
}
]
}