Print API

This article describes how to use the ezeep Blue print API. This API allows users or external processes to print documents that were uploaded formerly, referenced by URLs or release ezeep Blue Pull Print jobs.

Base URL

https://printapi.ezeep.com/

Get Configuration

With this request, you can retrieve 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/"
 GET "https://printapi.ezeep.com/sfapi/GetPrinterProperties/?id=<printer uuid>"
 GET "https://printapi.ezeep.com/sfapi/GetPrinterProperties/?printer=<printer name>"
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 uiid 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,
    "ColorSupported": true,
    "Driver": "TP Output Gateway",
    "DuplexMode": 2,
    "DuplexSupported": true,
    "Id": "176f7433-48b1-43c0-bf5f-637c0d831bdd",
    "Location": "",
    "MediaSupported": ["Auto", "Letter", "Legal", "Statement", "Executive", "A5", "B5", "A4", "Envelope Monarch", "Envelope No. 10 (COM10)", "Envelope DL", "Envelope C5", "Custom [Name Fixed]"],
    "MediaSupportedId": [0, 1, 5, 6, 7, 11, 13, 9, 37, 20, 27, 28, 256],
    "Name": "Canon UFR II Printer",
    "OrientationsSupported": ["portrait", "landscape"],
    "OrientationsSupportedId": [1, 2],
    "PaperFormats": [{
            "Id": 1,
            "Name": "Letter",
            "XRes": 2159,
            "YRes": 2794,
            "Default": false
        }, {
            "Id": 5,
            "Name": "Legal",
            "XRes": 2159,
            "YRes": 3556,
            "Default": false
        }, {
            "Id": 9,
            "Name": "A4",
            "XRes": 2100,
            "YRes": 2970,
            "Default": true
        }, {
            "Id": 27,
            "Name": "Envelope DL2",
            "XRes": 1100,
            "YRes": 2200,
            "Default": false
        }, {
            "Id2": 28,
            "Name": "Envelope C5",
            "XRes": 1620,
            "YRes": 2290,
            "Default": false
        }
    ],
    "Default":{         
                "Duplex": "duplex_simplex",     
                "DuplexIndex": 1,        
                "Color": "color",        
                "Orientation": null,        
                "OrientationIndex": null,        
                "Resolution": "600",    
                "Paper": "A4",    
                "PaperId": 9,     
                "Tray": "Multi-Purpose Feeder",   
                "TrayIndex": 284     
              },
    "Resolutions": ["Auto", "600"],
    "TPUID": 2,
    "Trays": [{
            "Index": 284,
            "Name": "Multi-Purpose Feeder",
            "Default": true
        }, {
            "Index": 285,
            "Name": "Manual Paper",
            "Default": false
        }, {
            "Index": 286,
            "Name": "Envelope Feeder",
            "Default": false
        }
    ]
}]

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.

PUT {{sasURI}}
Type Name Value
Header x-ms-blob-type BlockBlob
Header Content-Type multipart/form-data
File Fileupload 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.

Prints a file that you have uploaded.

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
paperlength int no If paperid == 256 (custom size): length of paper in tenths of mm
paperwidth int no If paperid == 256 (custom size): width of paper in tenths of mm
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
trayname string no Name of tray. See GetPrinterProperties
defaultsource int no Index of tray(if this value has been set, trayname should be ignored). See GetPrinterProperties
locale string no If this parameter has value (like “de-DE”, “en-US”), it will apply a specific Language settings(like date, numbers ,…) for spreadsheet or presentation documents(.doc, docx, .xsl, .xslx, .ppt, .pptx, …)
pageRanges string no It can set a range or numbers (separated with a comma) of pages in the file that can be printed (like “1-2,4-5”, “1,2,3” or “1-2,4-5, 7,8,9”)

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>" \
     '{
         "fileid":"<fileid>",
         "printerid":"<printerid>",
         "type":"pdf",
         "properties" :{"OrientationsSupported":"landscape","MediaSupported": "Letter"}
         }'

Example Response:

{
  "jobid": "ezprnds-d000001:HP Un_tpcb_788_7863578#2031753094:4"
}

Target documents’s URL must be public 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
trayname string no Name of tray. See GetPrinterProperties
defaultsource int no Index of tray(if this value has been set, trayname should be ignored). See GetPrinterProperties
locale string no If this parameter has value (like “de-DE”, “en-US”), it will apply a specific Language settings(like date, numbers ,…) for spreadsheet or presentation documents(.doc, docx, .xsl, .xslx, .ppt, .pptx, …)
pageRanges string no It can set a range or numbers (separated with a comma) of pages in the file that can be printed (like “1-2,4-5”, “1,2,3” or “1-2,4-5, 7,8,9”)

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", "MediaSupported": "Letter"}
        }'

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

Status Codes

Status Code Description
1246 INFO: no status available yet, keep asking
129 INFO: print job processing is running
0 INFO: print job successfully finished
3011 ERROR: something went wrong - restart print job
2 ERROR: invalid print job identifier

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