WebPrint API

Public API

API for communication with external systems - used by WebPrint Client for PHP and WebPrint Client for JavaScript.

Get printers list

Lists printers available on server

Endpoint

GET /web-print/printers

Query Options

KeyTypeDescription
typestringGet only printers compatible with specified type
ppd_optionsboolFetch also PPD options configuration for listed printers

Response

KeyType
data.*PrinterResource

Get printer details

Get details of one printer, including PPD configuration (if available)

Endpoint

GET /web-print/printers/{printer}

Response

KeyType
dataPrinterResource

Get promises list

Lists submitted print job promises to the server.

Endpoint

GET /web-print/promises

Response

Create promise

Creates new print task promise

Endpoint

POST /web-print/promises

Body

KeyTypeRequired
namestringyes
printerulidyes
available_printers[]ulidyes
typestringyes
ppd_options[]stringyes
meta[]stringyes
contentstringno
file_namestringonly when content is not empty
headlessboolyes

Response

Get promise details

Get details of submitted promise

Endpoint

GET /web-print/promises/{promise}

Response

Update promise

Update promise details

Endpoint

PUT /web-print/promises/{promise}

Body

KeyTypeRequired
statusenum (ready)no
namestringno
printerulidno
ppd_options[]stringno
meta[]stringno

Response

HTTP 204 No Content response

Delete promise

Deletes existing print promise

Endpoint

DELETE /web-print/promises/{promise}

Response

HTTP 204 No Content response

Get promise contents

Download print promise contents

Endpoint

GET /web-print/promises/{promise}/content

Response

If content was already uploaded, the response is served with application/octet-stream content type. Otherwise, the HTTP 404 error code will be served.

Upload promise content

Set print promise contents

Endpoint

POST /web-print/promises/{promise}/content

Body

There are three possible submission methods:

  1. multipart POST upload with key content for large or binary files,
  2. standard (form) POST with key content for smaller or text files - in this case you need to set file name (if you haven't set the file name when creating promise),
  3. Raw upload when there is no post content key. In this case you can optionally specify file name with X-File-Name header.

Response

HTTP 204 No Content response

Get print dialog details

Get details of created print promise dialog or throws 404 HTTP error.

Endpoint

GET /web-print/promises/{promise}/dialog

Response

Create or update print dialog

Create or update print dialog for print promise.

Endpoint

POST /web-print/promises/{promise}/dialog

Body

KeyTypeRequired
restricted_ipipno
redirect_urlurlno
auto_printboolno

Response

Convert promise to print job

Sends promise to print queue.

Endpoint

POST /web-print/jobs

Body

KeyTypeRequired
promiseulidyes

Response

HTTP 204 No Content response

Data Transfer Objects

PrintServerResource

KeyType
ulidulid
namestring
created_atdatetime
updated_atdatetime

PrinterResource

KeyType
ulidulid
serverPrintServerResource
namestring
locationstring or null
ppd_options[]string[]
ppd_options_layout[]string[]
raw_languages_supported[]string[]
uristring
created_atdatetime
updated_atdatetime

PrintJobPromiseResource

KeyType
ulidulid
statusenum (new, ready, canceled, sent_to_printer)
namestring
typestring
ppd_options[]string[]
content_availablebool
file_namestring or null
sizeint or null
meta[]string[]
available_printers[]PrinterResource[]
selected_printerPrinterResource
jobPrintJobResource or null
created_atdatetime
updated_atdatetime

PrintDialogResource

KeyType
ulidulid
statusenum (new, sent, canceled)
auto_printbool
redirect_urlurl or null
restricted_ipip or null
created_atdatetime
updated_atdatetime
linkurl
promisePrintJobPromiseResource

PrintJobResource

KeyType
ulidulid
statusenum (ready, printing, finished, canceled, failed)
status_messagestring
namestring
ppdbool
file_namestring
sizeint
printerPrinterResource
promisePrintJobPromiseResource or null
created_atdatetime
updated_atdatetime

Private API

Internal API used by WebPrint Service. You can write your own implementation of Print Service using this API.

Get list of pending jobs

Downloads a list of pending print jobs from server

Endpoint

GET /print-service/jobs

Query Options

KeyTypeDescription
long_pollboolIf enabled, in case of no new jobs, response will not be returned immediately. Server will be waiting for approximately 40 seconds before returning. If new print job arrive in meantime, server will respond quicker.

Response

KeyType
*ulid

Get details of pending job

Downloads a details of one pending job from server

Endpoint

GET /print-service/jobs/{job}

Response

KeyType
ulidulid
namestring
ppdbool
file_namestring
sizeint
optionsarray or null
printerarray
printer.namestring
printer.uristring
created_atdatetime
content_typeenum (file, base64, plain)
contentstring or null

content key value is depending on content_type key.

  • when content_type is plain, the content contains raw print job contents (used usually for text only printers, and printers using simple control codes),
  • when content_type is base64, the content contains raw print job contents encoded using Base64 function (used usually for lightweight PDF's and serial printers using complex and binary control codes),
  • when content_type is file, the content field contains link to download print job data.

Update job status

Updates job printing status with success or error message

Endpoint

POST /print-service/jobs/{job}

Body

KeyTypeRequired
statusenum (printing, finished, failed)yes
status_messagestringonly when status is failed

Response

HTTP 204 No Content response