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
Key | Type | Description |
---|---|---|
type | string | Get only printers compatible with specified type |
ppd_options | bool | Fetch also PPD options configuration for listed printers |
Response
Key | Type |
---|---|
data.* | PrinterResource |
Get printer details
Get details of one printer, including PPD configuration (if available)
Endpoint
GET /web-print/printers/{printer}
Response
Key | Type |
---|---|
data | PrinterResource |
Get promises list
Lists submitted print job promises to the server.
Endpoint
GET /web-print/promises
Response
Key | Type |
---|---|
data.* | PrintJobPromiseResource |
Create promise
Creates new print task promise
Endpoint
POST /web-print/promises
Body
Key | Type | Required |
---|---|---|
name | string | yes |
printer | ulid | yes |
available_printers[] | ulid | yes |
type | string | yes |
ppd_options[] | string | yes |
meta[] | string | yes |
content | string | no |
file_name | string | only when content is not empty |
headless | bool | yes |
Response
Key | Type |
---|---|
data | PrintJobPromiseResource |
Get promise details
Get details of submitted promise
Endpoint
GET /web-print/promises/{promise}
Response
Key | Type |
---|---|
data | PrintJobPromiseResource |
Update promise
Update promise details
Endpoint
PUT /web-print/promises/{promise}
Body
Key | Type | Required |
---|---|---|
status | enum (ready ) | no |
name | string | no |
printer | ulid | no |
ppd_options[] | string | no |
meta[] | string | no |
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:
- multipart POST upload with key
content
for large or binary files, - standard (form) POST with key
content
for smaller or text files - in this case you need to set filename
(if you haven't set the file name when creating promise), - Raw upload when there is no post
content
key. In this case you can optionally specify file name withX-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
Key | Type |
---|---|
data | PrintDialogResource |
Create or update print dialog
Create or update print dialog for print promise.
Endpoint
POST /web-print/promises/{promise}/dialog
Body
Key | Type | Required |
---|---|---|
restricted_ip | ip | no |
redirect_url | url | no |
auto_print | bool | no |
Response
Key | Type |
---|---|
data | PrintDialogResource |
Convert promise to print job
Sends promise to print queue.
Endpoint
POST /web-print/jobs
Body
Key | Type | Required |
---|---|---|
promise | ulid | yes |
Response
HTTP 204 No Content
response
Data Transfer Objects
PrintServerResource
Key | Type |
---|---|
ulid | ulid |
name | string |
created_at | datetime |
updated_at | datetime |
PrinterResource
Key | Type |
---|---|
ulid | ulid |
server | PrintServerResource |
name | string |
location | string or null |
ppd_options[] | string[] |
ppd_options_layout[] | string[] |
raw_languages_supported[] | string[] |
uri | string |
created_at | datetime |
updated_at | datetime |
PrintJobPromiseResource
Key | Type |
---|---|
ulid | ulid |
status | enum (new , ready , canceled , sent_to_printer ) |
name | string |
type | string |
ppd_options[] | string[] |
content_available | bool |
file_name | string or null |
size | int or null |
meta[] | string[] |
available_printers[] | PrinterResource[] |
selected_printer | PrinterResource |
job | PrintJobResource or null |
created_at | datetime |
updated_at | datetime |
PrintDialogResource
Key | Type |
---|---|
ulid | ulid |
status | enum (new , sent , canceled ) |
auto_print | bool |
redirect_url | url or null |
restricted_ip | ip or null |
created_at | datetime |
updated_at | datetime |
link | url |
promise | PrintJobPromiseResource |
PrintJobResource
Key | Type |
---|---|
ulid | ulid |
status | enum (ready , printing , finished , canceled , failed ) |
status_message | string |
name | string |
ppd | bool |
file_name | string |
size | int |
printer | PrinterResource |
promise | PrintJobPromiseResource or null |
created_at | datetime |
updated_at | datetime |
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
Key | Type | Description |
---|---|---|
long_poll | bool | If 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
Key | Type |
---|---|
* | ulid |
Get details of pending job
Downloads a details of one pending job from server
Endpoint
GET /print-service/jobs/{job}
Response
Key | Type |
---|---|
ulid | ulid |
name | string |
ppd | bool |
file_name | string |
size | int |
options | array or null |
printer | array |
printer.name | string |
printer.uri | string |
created_at | datetime |
content_type | enum (file , base64 , plain ) |
content | string or null |
content
key value is depending on content_type
key.
- when
content_type
isplain
, thecontent
contains raw print job contents (used usually for text only printers, and printers using simple control codes), - when
content_type
isbase64
, thecontent
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
isfile
, thecontent
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
Key | Type | Required |
---|---|---|
status | enum (printing , finished , failed ) | yes |
status_message | string | only when status is failed |
Response
HTTP 204 No Content
response