Printing Quick Guide
This guide will lead you through the different endpoints and functionalities of the Print API. It will help you to fully integrate the printing process of ezeep Blue into your workflows. You will learn all the necessary steps once you created an Authorization Code using the Authorization Code Flow from authenticating a user with access and refresh tokens, selecting a cloud connected printer, creating and uploading a document, customizing the settings for a print job, triggering a print job on a printer connected to ezeep Blue to finally getting information on the printjob status - all through the API.
Request access token
Once you have an Authorization Code, you must exchange it for tokens. Using the extracted Authorization Code (code) from the previous step.
POST 'https://account.ezeep.com/oauth/access_token/'
Type | Key | Value |
---|---|---|
Header | Authorization | Basic {{base_64_encoded_client_id}} |
Data | grant_type | authorization_code |
Data | scope | printing |
Data | code | {{authorization_code}} |
Data | redirect_uri | registered redirect_uri |
Example Request
curl -X POST 'https://account.ezeep.com/oauth/access_token/' \
--header "Authorization: Basic NzhLWXplWDV3UzhyMEZZejlLZHZOdDl4SE1SQTYxUEpLODBJSHdOajo=" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=authorization_code" \
--data "scope=printing" \
--data "code=<authorization_code>" \
--data-urlencode "redirect_uri=<registered redirect_uri>"
Example Response
{
"access_token": "eyJ0eXAiO...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "printing",
"refresh_token": "erliDdAb..."
}
Access_token
will be valid for 3600 seconds(1 hour) and after that duration you have to request new access token using the refresh token that you received in the access token response.
Use refresh token
You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It’s bad practice to call the endpoint to get a new Access Token every time you call an API.
To refresh your token, make a POST request to the /oauth/token
endpoint in the Authentication API, using grant_type=refresh_token
curl -X POST 'https://account.ezeep.com/oauth/access_token/'
Type | Key | Value |
---|---|---|
Header | Authorization | Basic {{base_64_encoded_client_id}} |
Header | Content-Type | application/x-www-from-urlencoded |
Data | grant_type | refresh_token |
Data | scope | printing |
Data | refresh_token | {{refresh_token}} |
Example request:
curl -X POST 'https://account.ezeep.com/oauth/access_token/' \
--header "Authorization: Basic NzhLWXplWDV3UzhyMEZZejlLZHZOdDl4SE1SQTYxUEpLODBJSHdOajo=' \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=refresh_token" \
--data "scope=printing" \
--data "refresh_token=qX5HTLt4..."
Example Response
{
"access_token": "eyJ0eXAiOiJ...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "",
"refresh_token": "vT5GTKk8..."
}
``refresh_token` You can use the refresh token once to generate a new access token and refresh token,it will also valid for 3600 seconds(1 hour).
You will need to replace and store the new refresh token securely from the response for future usage.
Printing
To print using the ezeep print api first you will need to work through the Authentication process and have a valid access token. You can now use this token to work through the following steps of the printing process.
Base URL
https://printapi.ezeep.com/
Get Configuration
With this request, you can retreive details of the currently authenticated user and related system configuration parameters . It is used to determine which filetypes are supported for printing (System:FILEEXT)
Get https://printapi.ezeep.com/sfapi/GetConfiguration/
Type | Key | Value |
---|---|---|
Header | Authorization | Bearer {{Access Token}} |
Example Request:
curl -X Get 'https://printapi.ezeep.com/sfapi/GetConfiguration/' \
--header "Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhb...."
Example response:
The response contains a list of available printers
{
"Drivers": {
"PrinterDynamic": "0e651413e003e36de6781cfe227a9cc2",
"PrinterStatic": "ee527381ab6ab5d4aba89f8ec2fd5d2c"
},
"Folders": [
{
"export": "",
"id": 1,
"op": 3
}
],
"SFForms": {
"$Count": 0
},
"Shell": [],
"System": {
"BW": 0,
"CONNECT": ":4001",
"CONNECTEX": ":4001",
"DocProvUplInterval": 60,
"FILEEXT": "bmp;csv;doc;docm;docx;dot;dotm;dotx;eml;gif;htm;html;jpeg;jpg;log;mht;mhtml;odf;odg;odm;odp;odt;otg;oth;otp;ott;pdf;png;pot;potm;potx;pps;ppsx;ppt;pptm;pptx;rtf;scp;sda;sdd;sds;sdw;sgl;smf;sti;stw;sxd;sxg;sxi;sxm;sxw;tif;tiff;tpf;txt;vor;wtx;xls;xlsb;xlsm;xlsx;xlt;xltm;xltx;xml;xps;",
"HOST": "https://vm-mfkym5000000:443",
"HOSTEX": "https://vm-mfkym5000000:443",
"MaxLocalPreviewFileSize": 16777216,
},
}...........
Section | Attribute | Type | Description |
---|---|---|---|
System |
FILEEXT |
string | list of supported file formats (file extension) |
Get Printer
Requests a list of printers available to the user
GET https://printapi.ezeep.com/sfapi/GetPrinter/
Type | Key | Value |
---|---|---|
Header | Authorization | Bearer {{Access Token}} |
Example Request:
The response contains a list of available printers:
curl -X GET 'https://printapi.ezeep.com/sfapi/GetPrinter/' \
--header "Authorization:Bearer <access_token>"
Example Response:
[
{
"id": "2fd4f571-7c2e-4042-8fc5-1d736f532e88",
"location": "Parallel Universe 2b-α-3187",
"name": "printer 6"
},
{
"id": "9620e656-b39b-49ba-a653-a3f168575ec2",
"location": "",
"name": "printer01"
}
]
Get Printer Properties
Returns further properties of the printer by printer id.
GET https://printapi.ezeep.com/sfapi/GetPrinterProperties/
Attribute | Type | Required | Description |
---|---|---|---|
Authorization |
Header | yes | Bearer {{Access Token}} |
printer |
string | no | The name of the printer. If it is empty, printerproperties of all available printers will be returned. |
id |
string | no | The id of the printer. If it is empty, printerproperties of all available printers will be returned. |
Specify either printer_name or printer_id. ezeep is following Microsofts DEVMODE for printer properties. You can find a detailed specification here
Example Request:
curl -X GET \
"https://printapi.ezeep.com/sfapi/GetPrinterProperties/?id=016bc036-2498-431e-84c6-14552639f515" \
--header "Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9."
Example response:
[
{
"Collate": true,
"Color": false,
"Driver": "",
"DuplexMode": 0,
"DuplexSupported": false,
"Id": "9620e656-b39b-49ba-a653-a3f168575ec2",
"Location": "",
"MaxXExtent": 0,
"MaxYExtent": 0,
"Name": "printer01",
"OrientationsSupported": ["portrait", "landscape"],
"OrientationsSupportedId": [1, 2]
}
]
Prepare file upload
Uploads a file to print.
GET https://printapi.ezeep.com/sfapi/PrepareUpload/
Type | Key | Value |
---|---|---|
Header | Authorization | Bearer {{Access Token}} |
Example request:
curl -X GET 'https://printapi.ezeep.com/sfapi/PrepareUpload/' \
--header "Authorization:Bearer <access__token>"
Example Response:
The response will include the file id of your new document as well as the sasURI which we will use for the upload later on:
{
"fileid": "ERI_be20b4d1-d6b8-41ee-8ca8-580905b9b4ed",
"sasUri": "https://rndsvcezp.blob.core.windows.net/userstorage/ERI_be20b4d1-d6b8-41ee-8ca8-580905b9b4ed?sv=2018-03-28&sr=b&sig=FxuLjL2Kids9Ww60dqQ6FlqscTTccKFBwk%2Ft0Tyf%2BM0%3D&se=2020-05-22T15%3A45%3A12Z&sp=wl"
}
File Upload
Uploads a file to print. For uploading, the sasUri returned in PrepareUpload is used. This Uri points to a global Azure Blob Storage. There are two kinds of uploading files available - upload in one part and the file length is known in advance and upload in chunks - not HTTP Content-Transfer-Encoding “chunked” is meant here, but splitting the upload in several parts - one HTTP request per part. Content-Type could be “multipart/form-data” - the body needs to contain one file part or “application/binary” - the body contains just the plain file data.
Upload in one part
PUT {{sasUri}}
Type | Name | Value |
---|---|---|
Header | x-ms-blob-type | BlockBlob |
Header | Content-Type | multipart/form-data or application/binary |
form-data parameter | File | file=@C:/Users/User/Desktop/testfile.pdf |
Example request:
curl -X PUT \
"https://rndsvcezp.blob.core.windows.net/userstorage/ERI_db66aea1-f702-4a0a-b2ee-37a7cdacd376?
sv=2019-07-07&sr=b&sig=9y%2Fs5gOgVZgxI2ap634TnKQzilTmTcicCOOIWYVVnNs%3D&se=2021-02-08T23%3A06%3A52Z&sp=wl"
--header "x-ms-blob-type: BlockBlob" \
--header "Content-Type: multipart/form-data" \
-F "file=@C:/Users/User/Desktop/testfile.pdf"
If successful, you will receive an empty HTTP 201 (created) response.
Upload in multiple parts
1st call: create the AppendBlob type blob
PUT {{sasUri}}
Type | Name | Value |
---|---|---|
Header | x-ms-blob-type | AppendBlob |
Header | Content-Type | application/binary |
Header | Content-Length | 0 |
Example request:
curl -X PUT \
"https://rndsvcezp.blob.core.windows.net/userstorage/ERI_db66aea1-f702-4a0a-b2ee-37a7cdacd376?
sv=2019-07-07&sr=b&sig=9y%2Fs5gOgVZgxI2ap634TnKQzilTmTcicCOOIWYVVnNs%3D&se=2021-02-08T23%3A06%3A52Z&sp=wl"
--header "Content-Type: application/binary" \
--header "x-ms-blob-type: AppendBlob" \
--header "Content-Length: 0"
If successful, you will receive an empty HTTP 201 (created) response.
2nd and following calls:
Pay attention to append the described parameter to the sasUri.
PUT {{sasUri}}&comp=appendblock
Type | Name | Value |
---|---|---|
Header | x-ms-blob-type | BlockBlob |
Header | Content-Type | application/binary (same as in first call) |
Example request:
curl -X PUT \
"https://rndsvcezp.blob.core.windows.net/userstorage/ERI_db66aea1-f702-4a0a-b2ee-37a7cdacd376?
sv=2019-07-07&sr=b&sig=9y%2Fs5gOgVZgxI2ap634TnKQzilTmTcicCOOIWYVVnNs%3D&se=2021-02-08T23%3A06%3A52Z&sp=wl&comp=appendblock"
--header "Content-Type: application/binary" \
--header "x-ms-blob-type: AppendBlob" \
--header "Content-Length: 42"
--data-binary @-
If successful, you will receive an empty HTTP 201 (created) response. The bodies of the requests contains just plain binary data parts that will be joined to the whole binary file that shall be printed.
Print an uploaded file
Prints a file that you have uploaded before or releases an AnyPrinter print job.
POST https://printapi.ezeep.com/sfapi/Print/
Parameters:
Attribute | Type | Required | Description |
---|---|---|---|
fileid |
string | yes | Id of the uploaded file. See PrepareUpload
|
type |
string | yes | Type of the file. (e.g. txt) |
alias |
string | no | Original name of file/document. If it is empty, the fileid will be used. |
printerid |
string | yes | Id of the printer. See GetPrinterProperties . |
printanddelete |
bool | no | If true the uploaded document will be deleted after printing. If false the uploaded document remains on the server. Default is false . |
paperid |
int | no | Id of of paper size. See GetPrinterProperties
|
color |
bool | no | Enable color. See GetPrinterProperties
|
duplex |
bool | no | Enable duplex. See GetPrinterProperties
|
duplexmode |
int | no | Duplex mode. See GetPrinterProperties
|
orientation |
int | no | Id of orientation mode. See GetPrinterProperties
|
copies |
int | no | Count of copies. See GetPrinterProperties
|
resolution |
string | no | DPI / quality . See GetPrinterProperties
|
Example request:
The request parameters need to be sent in the body in JSON format.
curl -X POST 'https://printapi.ezeep.com/sfapi/Print' \
--header "Content-Type':'application/json' \
--header "Authorization':'Bearer <token>' \
--data "{
'fileid':'<fileid>',
'printerid':'<printerid>',
'type':'pdf',
'properties' : {"OrientationsSupported":"landscape"}
}"
Example Response:
{
"jobid": "ezprnds-d000001:HP Un_tpcb_788_7863578#2031753094:4"
}
Print a file referenced by URL
Target documents’ URL must be publicly reachable and must contain all information needed to download the file (e.g. authorization information if needed).
Request and response are more or less the same as for Print an uploaded file. But the JSON attribute fileid is replaced by fileurl. Since the file is downloaded in background it’s not unlikely (depending on file’s size) that printing can’t start immediately. In this case you will receive HTTP 412 Precondition failed and the response provides you a fileid you can use for Print an uploaded file.
POST https://printapi.ezeep.com/sfapi/Print/
Parameters:
Attribute | Type | Required | Description |
---|---|---|---|
fileurl |
string | yes | URL of the file to print |
type |
string | yes | Type of the file. (e.g. txt) |
alias |
string | no | Original name of file/document. If it is empty, the fileid will be used. |
printerid |
string | yes | Id of the printer. See GetPrinterProperties . |
printanddelete |
bool | no | If true the uploaded document will be deleted after printing. If false the uploaded document remains on the server. Default is false . |
paperid |
int | no | Id of of paper size. See GetPrinterProperties
|
color |
bool | no | Enable color. See GetPrinterProperties
|
duplex |
bool | no | Enable duplex. See GetPrinterProperties
|
duplexmode |
int | no | Duplex mode. See GetPrinterProperties
|
orientation |
int | no | Id of orientation mode. See GetPrinterProperties
|
copies |
int | no | Count of copies. See GetPrinterProperties
|
resolution |
string | no | DPI / quality . See GetPrinterProperties
|
Example request:
curl -X "https://printapi.ezeep.com/sfapi/Print" \
--header "Content-Type:application/json" \
--header "Authorization:Bearer eyJ0eXAiOiJKV1..." \
--data "{
'fileurl':'https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf','printerid':'016bc036-2498-431e-84c6-14552639f515',
'type':'pdf',
'properties' : {"OrientationsSupported":"landscape"}
}"
Example Response if file has printed:
{
"jobid": "ezprnds-d000001:HP Un_tpcb_788_7863578#2031753094:4"
}
Example response if file is still uploading (larger files):
{
"fileid": "ERI_be20b4d1-d6b8-41ee-8ca8-580905b9b4ed",
"sasUri": ""
}
Get Status
You can retrieve information on the printjob state with the following request:
GET https://printapi.ezeep.com/sfapi/Status/?id=:id
Parameters:
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | yes | The Job identifier. See Print . |
Example request:
curl -X GET \
"https://printapi.ezeep.com/sfapi/status/?id=ezprnds-p00000M:HP%20Co_tpcb_4936_114813343#1801071420:1" \
--header "Authorization: Bearer <access__token"
Example response:
{
"jobpagesprinted": 0,
"jobpagestotal": 1,
"jobposition": 1,
"jobstatus": 129,
"jobstatusstring": "PRINTING|RETAINED|"
}
X-CBStatus Codes
Status Code | Description |
---|---|
2 | ERROR: invalid print job identifier |
3011 | ERROR: something went wrong - restart print job |
12007 | ERROR: The url specified for printing is not valid |
0 | INFO: print job successfully finished |
129 | INFO: print job processing is running |
These codes are expected and should be handled adequately.
Error codes
Stuck with an error code? We are using Microsoft error codes that are represented by an integer. Find a comprehensive list here: https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes