API section
Printing
Printing PDF by URL or as a file, images and printer commands (ESC/POS, ZPL, EPL) on Windows printers and driverless printers; the printer by name, device number or role. Printer queue and status.
| GET | /api/v1/print-jobs | Agent print jobs |
| POST | /api/v1/print-jobs | Printing |
| POST | /api/v1/print-jobs/{id}/retry | Retry a print job |
| POST | /api/v1/print-jobs/{id}/cancel | Cancel a print job |
| GET | /api/v1/printers | Windows printers, their roles and print settings |
| GET | /api/v1/printers/status | Printer status |
| GET | /api/v1/printers/jobs | System printer queue |
| DELETE | /api/v1/printers/jobs | Clear the printer queue |
| GET | /api/v1/printers/capabilities | Printer capabilities |
Agent print jobs#
/api/v1/print-jobsNewest first; status as for operations: QUEUED, RUNNING, SUCCEEDED, FAILED
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit | query | integer int32 |
Response 200 application/json
Array · Operation
idstring uuidtypestringidempotencyKeystringresourcesarray of stringstatusstringvalues:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultany valueerrorOperationError3 fields · OperationError
codestringmessagestringdetailsany value
warningsarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/print-jobs'curl 'https://cloud.hw-connector.ru/agent/api/v1/print-jobs' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'PDF by URLs, a ready PDF or images — with printer settings (scale, paper); raw — ESC/POS, ZPL, EPL commands straight to the printer. URLs are downloaded before printing
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Keyrequired | header | string | |
Prefer | header | string |
Request body application/json required
Fields · PrintJobRequest
urlsarray of stringdocumentstringimagesarray of stringrawstringtextarray of TextLine4 fields · TextLine
kindstringrequiredvalues:TEXTPAIRSEPARATORtextstringrightstringalignstringvalues:LEFTCENTERRIGHT
printerstringdeviceinteger int32rolestringcopiesinteger int32from 1to 20htmlstringhtmlUrlstringoptionsPrintOptions14 fields · PrintOptions
pagesstringduplexstringvalues:ONE_SIDEDLONG_EDGESHORT_EDGEtraystringcolorstringvalues:COLORMONOCHROMEdpiinteger int32nUpinteger int32from 1to 16collatebooleanorientationstringvalues:AUTOPORTRAITLANDSCAPErotationinteger int32scalingstringvalues:ACTUALFITSHRINKpaperWidthMmnumber doublepaperHeightMmnumber doublemarginsMmstringjobNamestring
expireAfterSecinteger int32from 1
{
"urls": [
"string"
],
"document": "string",
"images": [
"string"
],
"raw": "string",
"text": [
{
"kind": "TEXT",
"text": "string",
"right": "string",
"align": "LEFT"
}
],
"printer": "string",
"device": 1,
"role": "string",
"copies": 1,
"html": "string",
"htmlUrl": "string",
"options": {
"pages": "string",
"duplex": "ONE_SIDED",
"tray": "string",
"color": "COLOR",
"dpi": 1,
"nUp": 1,
"collate": false,
"orientation": "AUTO",
"rotation": 1,
"scaling": "ACTUAL",
"paperWidthMm": 1.5,
"paperHeightMm": 1.5,
"marginsMm": "string",
"jobName": "string"
},
"expireAfterSec": 1
}Response 200 application/json
Fields · Operation
idstring uuidtypestringidempotencyKeystringresourcesarray of stringstatusstringvalues:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultany valueerrorOperationError3 fields · OperationError
codestringmessagestringdetailsany value
warningsarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/print-jobs' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"urls":["string"],"document":"string","images":["string"],"raw":"string","text":[{"kind":"TEXT","text":"string","right":"string","align":"LEFT"}],"printer":"string","device":1,"role":"string","copies":1,"html":"string","htmlUrl":"string","options":{"pages":"string","duplex":"ONE_SIDED","tray":"string","color":"COLOR","dpi":1,"nUp":1,"collate":false,"orientation":"AUTO","rotation":1,"scaling":"ACTUAL","paperWidthMm":1.5,"paperHeightMm":1.5,"marginsMm":"string","jobName":"string"},"expireAfterSec":1}'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/print-jobs' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"urls":["string"],"document":"string","images":["string"],"raw":"string","text":[{"kind":"TEXT","text":"string","right":"string","align":"LEFT"}],"printer":"string","device":1,"role":"string","copies":1,"html":"string","htmlUrl":"string","options":{"pages":"string","duplex":"ONE_SIDED","tray":"string","color":"COLOR","dpi":1,"nUp":1,"collate":false,"orientation":"AUTO","rotation":1,"scaling":"ACTUAL","paperWidthMm":1.5,"paperHeightMm":1.5,"marginsMm":"string","jobName":"string"},"expireAfterSec":1}'A new job with the same documents and options; needs a new Idempotency-Key
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string uuid | |
Idempotency-Keyrequired | header | string | |
Prefer | header | string |
Response 200 application/json
Fields · Operation
idstring uuidtypestringidempotencyKeystringresourcesarray of stringstatusstringvalues:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultany valueerrorOperationError3 fields · OperationError
codestringmessagestringdetailsany value
warningsarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/print-jobs/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/retry' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/print-jobs/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/retry' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30'Cancel a print job#
/api/v1/print-jobs/{id}/cancelOnly while it waits for the printer (QUEUED); a started job is already in the Windows queue — clear it with DELETE /printers/jobs
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string uuid |
Response 200 application/json
Fields · Operation
idstring uuidtypestringidempotencyKeystringresourcesarray of stringstatusstringvalues:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultany valueerrorOperationError3 fields · OperationError
codestringmessagestringdetailsany value
warningsarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/print-jobs/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/cancel'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/print-jobs/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/cancel' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Windows printers, their roles and print settings#
/api/v1/printersResponse 200 application/json
Array · PrinterInfo
namestringisDefaultbooleanrolesarray of stringsettingsPrinterSettings4 fields · PrinterSettings
scalingstringvalues:ACTUALFITSHRINKorientationstringvalues:AUTOPORTRAITLANDSCAPEpaperWidthMmnumber doublepaperHeightMmnumber double
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/printers'curl 'https://cloud.hw-connector.ru/agent/api/v1/printers' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Printer status#
/api/v1/printers/statusReady, printing, offline, error and reasons (no paper, jam, door open); changes arrive as printer events
Response 200 application/json
Array · Status
enabledbooleanconsentbooleanforcedbooleanlastSentstring date-timelastErrorstringpreviewJsonNode24 fields · JsonNode
emptybooleanarraybooleannullbooleanobjectbooleanfloatbooleannumberbooleanintbooleandoublebooleantextualbooleanlongbooleanshortbooleanstringbooleanpojobooleanbooleanbooleanbinarybooleannodeTypestringvalues:ARRAYBINARYBOOLEANMISSINGNULLNUMBEROBJECTPOJOSTRINGmissingNodebooleanfloatingPointNumberbooleanbigIntegerbooleanbigDecimalbooleancontainerbooleanintegralNumberbooleanvalueNodebooleanembeddedValueboolean
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/printers/status'curl 'https://cloud.hw-connector.ru/agent/api/v1/printers/status' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'System printer queue#
/api/v1/printers/jobsJobs in the Windows queue (CUPS on Linux and macOS), including ones not from the agent
Parameters
| Name | In | Type | Description |
|---|---|---|---|
namerequired | query | string |
Response 200 application/json
Array · Job
idstringdocumentstringstatusstringpagesinteger int32submittedstring
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/printers/jobs?name=text'curl 'https://cloud.hw-connector.ru/agent/api/v1/printers/jobs?name=text' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Clear the printer queue#
/api/v1/printers/jobsRemoves all jobs from this printer's Windows (CUPS) queue
Parameters
| Name | In | Type | Description |
|---|---|---|---|
namerequired | query | string |
Response 200 application/json
Type: map → any value
Errors — problem+json with a code field, see error codes.
Request example
curl -X DELETE 'http://localhost:7790/api/v1/printers/jobs?name=text'curl -X DELETE 'https://cloud.hw-connector.ru/agent/api/v1/printers/jobs?name=text' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Printer capabilities#
/api/v1/printers/capabilitiesTrays, paper, duplex, color, resolutions, copies, N-up — as reported by the driver
Parameters
| Name | In | Type | Description |
|---|---|---|---|
namerequired | query | string |
Response 200 application/json
Type: map → any value
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/printers/capabilities?name=text'curl 'https://cloud.hw-connector.ru/agent/api/v1/printers/capabilities?name=text' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'