Pull Printing Release Workflow for Trusted User App

This article describes the ezeep Pull Print job release process for apps that run on user devices (e.g. mobile phones), i.e. the user authenticates himself on the app that gets some access key along with a refresh token for long-time use (“save password”). These tokens must be stored by the app in a secure location. More about Authorization workflow can be found at Authorization

After printing a document to the “Anyprinter” printer, that creates a printjob in the ezeep Blue backend but does not print it out. The stored Pull Print job can be rendered and thus printed out by calling a print request with the job id of the document and the id of the printer. This document describes the requests needed for that.

Base URLs

https://api2.ezeep.com
https://printapi.ezeep.com

Get User’s Print Jobs

Requests the list of pull printing jobs ready to print.

GET "https://api2.ezeep.com/printing/v1/printjobs/?o=<order criteria>&limit=<maximum count of returned printjobs>&offset=<start in the printjob list>&status=<state of the print job>"

Supported Attributes:

Parameter Type Required Description
Authorization Header Yes Bearer {{Access Token}}
o string No Which field to use when ordering the results. “created” returns the print jobs ordered by the creation date. A leading “-“ orders the result descending.
limit integer No Number of results to return per page. The default and maximum value is 100.
offset integer No The initial index from which to return the results.
status string No Returns only printjobs in the given state. Possible values: INQUEUE, DONE, EXPIRED, ERROR. Has to be set to “INQUEUE” to return the pull printing jobs ready to print.

If successfull, returns a 2xx HTTP status code and a list of print jobs matching the request attributes and having the following response attributes:

Section Attribute Type Description
root count integer absolute count of printjobs on the server matching the request attributes
results id string identifier of the printjob (UUID)
results file_name string Name of the rendered printjob file on the server. maxLength: 255, minLength: 1
results display_name string Name of the original uploaded file. maxLength: 255, minLength: 1
results status string Status of the print job. Enum: [ INQUEUE, DONE, EXPIRED, ERROR ]
results file_size_bytes integer Size of the file in bytes
results last_updated string Datetime in UTC. Format: yyyy-MM-dd’T’HH:mm:ss.SSS’Z’
results created string Datetime in UTC. Format: yyyy-MM-dd’T’HH:mm:ss.SSS’Z’

Example Request:

curl -X Get "https://api2.ezeep.com/printing/v1/printjobs/?o=-created&limit=100&offset=0&status=INQUEUE"
    --header "Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhb...." 

Example Response: In this case, all pull printing jobs ready for release.

{
  "count": 1,
  "results": [
      {
          "id": "4e7f75fa-26b9-49de-b896-010df92ae84f",
          "file_name": "4c733493-dce3-4e21-89ca-47534bac36d2_54e3a324-cc89-4722-8338-c285d26bef15_40c03a9c-297f-47b7-a0ad-c1359a8fa017",
          "display_name": "IMG-20221016-WA0011(3).jpg",
          "status": "INQUEUE",
          "file_size_bytes": 638022,
          "last_updated": "2023-01-09T10:57:52.456956Z",
          "created": "2023-01-09T10:57:52.456909Z"
      }
  ]
}
  

Get User Information

Requests the printing abilities of the authenticated user. The app must not work unless pull_printing_enabled is set to true and must not provide WiFi/local LAN print functionality (print stream is route via the Pull Print app) unless local_printing_enabled is set to true.

GET "https://api2.ezeep.com/printing/v1/users/me/"
Parameter Type Required Description
Authorization Header Yes Bearer {{Access Token}}

Example Request:

curl -X Get "https://api2.ezeep.com/printing/v1/users/me/" \
     --header "Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhb...."

Example Response:

The response contains information about the authorized services and group membership of the authenticated user.

{
    "id":"40c03a9c-297f-47b7-a0ad-c1359a8fa017",
    "local_printing_enabled":true,
    "self_service_enabled":false,
    "myprinters_enabled":true,
    "pull_printing_enabled":true,
    "print_later_enabled":true,
    "groups":[
        {
            "group_id":"e4a5d08a-f14e-4cd1-bb19-499e1edaf85d"
        },
        {
            "group_id":"303450f7-b63d-4b50-88b3-5c2ac91dadca"
        },
        {
            "group_id":"1b9cdbd4-ffc8-4688-851c-10dff74ba15a"
        },
        {
            "group_id":"6853e2da-0103-4537-8952-6a2676cfd306"
        }
    ]
}

Attribute Type Description
id string identifier of the user (UUID)
local_printing_enabled bool Local printing enabled
self_service_enabled bool Self service enabled
myprinters_enabled bool Myprinters enabled
pull_printing_enabled bool Pull printing enabled
print_later_enabled bool Print later enabled
groups array Array of strings with the group Ids (UUID) the user belongs to

Delete Print Jobs

Delete a pull printing job.

DELETE "https://api2.ezeep.com/printing/v1/printjobs/<print job id>/"
Parameter Type Required Description
Authorization Header Yes Bearer {{Access Token}}

Example Request:

curl -X Delete "https://api2.ezeep.com/printing/v1/printjobs/4e7f75fa-26b9-49de-b896-010df92ae84f/" \
     --header "Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhb...."

Prints a pull printing job. The print out is started by passing the fileid and the printerid to the printapi server. For additional information about this request see the Print API reference

POST "https://printapi.ezeep.com/sfapi/Print"
Parameter Type Required Description
Authorization Header Yes Bearer {{Access Token}}
Content-Type Header Yes “application/json”
fileid string Yes The file_name returned in the printjob request. See Get print jobs.
printerid string Yes Id of the printer.
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.

Example Request:

curl -X POST "https://printapi.ezeep.com/sfapi/Print" \
     --header "Content-Type: application/json; charset=UTF-8" \
     --header "Authorization: Bearer <token>" \
     --data '{
            "fileid":"2e52ed01-4770-4d73-83a1-fa4baf463abf_c4ca7e87-e51f-4163-b890-cf219ad5f6f5_3a5dc33a-2926-4ed6-af77-bbd0d0a3b6da",
            "printerid":"987dfd17-739b-441d-b2f5-2db01c4424ba",
            "printanddelete":true
     }'