Receipt Printer API

This endpoint allows monitoring configured printer and printing receipts using specified template and data.

Url

The base url is http://localhost:8526/DeviceService/PrinterService .

Status

Get the current status of the printer named in the device service configuration. This can be used to check if a printer is available before attempting to print a receipt. Note that an external printer monitor may be required in order to get detailed information on the printer status.

URL:

/status

Method:

GET

URL Params:

none

Data Params:

none

Example:
GET http://localhost:8526/DeviceService/printerservice/status HTTP/1.1
Authorization: Basic a2l0dGVuczphcmVzb2xvdmVseQ==
Content-Type: application/json
Success Response:
Code:

200 OK

Content-Type:

application/json

Content Body:

Printer Status

HTTP/1.1 200 OK
Content-Length: 37
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 16 Mar 2017 11:12:53 GMT

{
    "IsOutOfPaper": false,
    "IsOffline": false,
    "IsPaperJammed": false,
    "NeedUserIntervention": false,
    "HasPaperProblem": false,
    "IsBusy": false,
    "IsInError": false,
    "IsNotAvailable": false,
    "IsOutOfMemory": false,
    "IsPaused": false,
    "IsNotFound": false
}
Error Response:
Code:

401 Unauthorized

Example:

HTTP/1.1 401 Unauthorized
Content-Length: 45
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 16 Mar 2017 11:21:10 GMT

{
    "ResponseStatus": {
        "ErrorCode": "Invalid UserName or Password",
        "Message": "Invalid UserName or Password"
    }
}

Printer API Models

Printer Status

The printer status has the following boolean fields for possible problems. The fields default to false, and if the printer is available to use, all the fields should be false. If a printer reports a problem when status is queried, the corresponding field will be set to true. Note that some printers may not accurately return all this information, so it is possible for a print receipt request to fail even if the status returned by a status request did not indicate errors. If the IsNotFound is set to true, a printer named in the Device Service configuration was not found, so it may indicate an error in the configuration of the device service.

Field name

IsBusy

IsInError

IsNotAvailable

IsOffline

IsOutOfMemory

IsOutOfPaper

IsPaperJammed

IsPaused

HasPaperProblem

NeedUserIntervention

IsNotFound

Printing Status

These are the status codes returned with a Print Receipt request. The Description returned will vary and may give further details in case of an error.

StatusCode

Example Description

Explanation

0

NoPrintQueue

This indicates an external error such as a printer not available or the configuration for a printer being invalid. (Ensure that the printer is correctly installed and plugged in. The device service must also be configured to use this printer, the configuration is done during initial set up. Please contact us if you wish to change printers.)

1

SuccessfullySentToPrintQueue

Receipt created successfully and sent to print queue. Note that we cannot guarantee the printing will finish successfully, but a printer was found and the item was added to the queue.

2

ErrorCreatingReceipt

An error occurred while creating the receipt so the receipt cannot be printed. This may also mean that the receipt template is missing or invalid.