API Endpoints

POST /v2/printer/open/open/device/pushContent
Print Receipt

This endpoint is used to send a print job to a specific printer via Sunmi Cloud for printing a receipt. The receipt content must be in ESC/POS commands.

Request Body:
{
    "sn": "string",
    "content": "string",
}
Response (201 Created):
{
    "code": 1,
    "msg": "success",
    "data": {
        "trade_no": "1728207421540789905"
    }
}
								
POST /v2/printer/open/open/device/pushVoice
Push Voice or sound Message

This endpoint is used to send a voice message to a printer connected via Sunmi Cloud. The printer will play the voice message upon receiving the command. This can be used for alerts or notifications such as order confirmations.

Request Body:
{
    "sn": "string",
    "media_url": "string"
}
Response (200 OK):
{
    "code": 1,
    "msg": "success",
    "data": {
        "trade_no": "1728601553951206470"
    }
}
POST /v2/printer/open/open/ticket/printStatus
Get Print Job Status

This endpoint is used to retrieve the current status of a specific print job that was sent to a printer via Sunmi Cloud. It returns details about whether the print job is still processing, completed, or has encountered an error.

Request Body:
{
    "trade_no": "string"
}
Response (200 OK):
{
    "code": 1,
    "msg": "success",
    "data": {
        "sn": "N4113227P00012",
        "is_print": 1,
        "print_time": 1728601558
    }
}
POST /v2/printer/open/open/device/clearPrintJob
Clear Printer Jobs

This endpoint is used to clear all ongoing or pending print jobs on a specific printer connected via Sunmi Cloud. When called, the printer's job queue will be cleared, and any unfinished print jobs will be canceled.

Request Body:
{
    "sn": "string"
}
Response (200 OK):
{
    "code": 1,
    "msg": "success",
    "data": {
        "trade_no": "1728601553951206470"
    }
}
POST /v2/printer/openDrawer
Open Cash Drawer

This endpoint is used to open the cash drawer connected to a specific printer via Sunmi Cloud. When called, the drawer will trigger the open mechanism based on the provided parameters.

Request Body:
{
    "sn": "string"
}
Response (200 OK):
{
    "code": 1,
    "msg": "success",
    "data": {
        "trade_no": "1728601553951206470"
    }
}
POST /v2/printer/test
Test Printer

This endpoint is used to send a simple test print job to a printer connected via Sunmi Cloud. The printer will print a basic test message to confirm its operation and connection status.

Request Body:
{
    "sn": "string"
}
Response (200 OK):
{
    "code": 1,
    "msg": "success",
    "data": {
        "trade_no": "1728601553951206470"
    }
}