Using REST API for Error Reporting – SENTINEL Reference

Target Audience: Advanced User, IT Manager
Article #: 13874

Summary

Using REST API for error reporting in SENTINEL allows you to give feedback to the host system. This feedback can include errors relating to:

  • POSTing of the print job
  • GETting subsequent errors detected by SENTINEL during the processing of the print job

This article explains what information the REST API creates, where the information is stored and how to use it to be notified of any errors during the SENTINEL printing job request process.

Information

PART 1: POSTing the Print Job to the SENTINEL REST API

The general concept behind error checking begins with the POST of a print job. When the POST is completed, SENTINEL will return either:

A. POSTing error – Typically indicating a problem with the syntax of the POST.

Example of a failed POST due to a syntax error (missing quote) using Swagger.

B. JobModel block of text – Indicates a successful POST. It will include the job ID, status and other important information.

Data structure of a JobModel

The SENTINEL REST API automatically responds to the POST with a POSTing error message. The host system can capture that and use the data to report the POST error back to the end user or to take other responsive actions.

The SENTINEL REST API will automatically respond to a successful POST with a JobModel data set. For the second element of this printing concept to work properly, the host system MUST note the ID provided in the JobModel. In the example image above, this is the second line Int64. This ID will be required for identifying any SENTINEL processing errors.

However, a successful POST does not automatically indicate a successful print job. It only means that the SENTINEL REST API accepted the POST. After a successful POST, SENTINEL must then process the print job.

PART 2: Use GET to Look for SENTINEL Processing Errors

The second element of the REST API general concept involves checking for label processing errors.

After a successful POST, the processing of the print job by SENTINEL may or may not succeed. In order to succeed, the data accepted by the API must map correcting into the label design. This requires:

  • SENTINEL must find the label design file
  • SENTINEL must also correctly match the printer named in the REST API POST to an installed, working printer driver

If either of these two actions fail, the print job will fail. Since SENTINEL runs on a server, the failure will typically go unnoticed until the end user discovers that the label(s) never printed.

When SENTINEL encounters errors in processing the label job request, it will post the erorr in the logs. Experienced SENTINEL users will recognize a common issue in these logs – SENTINEL reports errors from REST API requests in the same manner as it reports errors in print job requests from other plug ins such as drop file, database watch, TCP-IP string, serial port and etc. This can be seen in the image, below.

SENTINEL Error Log for REST API Print Job Request

ONLY by periodically running a GET will the host system know if SENTINEL hit an error in processing the print job request. SENTINEL REST API does not POST any message to the host about SENTINEL processing errors. As a result, the host must routinely run GET statements to check on the success of POSTed print jobs.

Example of a GET request using Swagger

In order for the host system to be able to identify which print job request failed, it must have the ID from the JobModel which was returned after the successful POST. The GET (full-info) request sent to SENTINEL will return all of the latest-run job requests received over a given period. Settings within SENTINEL determine how long the print requests are retained. Typically, the settings range from several minutes to several hours. Because of this, in order to discover which print job requests failed, the host will need to reference the ID (aka “Job Item #) within the SENTINEL log.

Example of a GET (full-info) Request Listed by Job Item ID (aka “ID)

In order to provide as much information as possible about the status of print job requests sent to SENTINEL via the REST API, the host system should:

  • Report back on post errors in the initial POST. The response is immediate.
  • Record the ID sent pack on the successful POST
  • Periodically run GETs to check on the status of the print job requests. These are referenced by the ID.
  • Report back any errors on a given print job request as SENTINEL runs it.

Helpful Links

SENTINEL 2021 Rest Web API Plugin (PDF)

Additional Comments

Issue found with NiceLabel 2019, Designer Express Edition

If you need further assistance, please contact us.

Author


Was this article helpful?

Related Articles