Clipboard API

This API allows you to configure interaction with third-party programs that work on a remote server via RDP and there is no possibility of installing AzureLabel on a remote server. In this case, the data is transferred through a clipboard shared between the local computer and the remote server.

To work with this API, the program is launched in the API server mode; for this, the -apiserver command line parameter is used. You can also use the Windows Start menu to run the program in API server mode:

After the first launch, you need to set the flag through the context menu of the program in the tray:

(this corresponds to the setting "apiServer": {"useClipboardInsteadOfHttpForDataExchange": true} in the program settings file config.json).

In this API, the application receives requests through the clipboard and executes commands or sends data to the clipboard. To do this, the server scans the contents of the clipboard at intervals of 1 second. If the clipboard contains text data and this data is a request to the server, then the server executes the commands and places the response on the clipboard.

To transfer information to the program, text data of a special format is used in the form of a text block in the clipboard.

Request to the server

To request the server to the clipboard, you need to place the following lines:

  1. AzureLabelClipboardAPIRequest
  2. Path along with parameters as in the REST API documentation. The path and parameters are concatenated according to the URI composition rule. For example /templates?encoding=utf-8&format=text
  3. The data is in JSON format as it is described in the "Request body" section of the "/labels/print" section of the REST API documentation.

    Optional string.

You can familiarize yourself with the REST API by visiting the AzureLabel REST API Documentation.

Examples of Requests

Show preview using ready data:

AzureLabelClipboardAPIRequest
/labels/preview
{
    "label": "My label",
    "dataSource": {
        "sourceType": "readyData",
        "readyData": [
            {
                "PrintQuantity": 3,
                "Name": "AzureLabel Pro, yearly subscription",
                "Barcode": "5678901234562",
                "Price": 69,
                "Unit": "ea",
                "Code": "pro-y"
            },
            {
                "PrintQuantity": 1,
                "Name": "AzureLabel Corporate, yearly subscription",
                "Barcode": "8901234567890",
                "Price": 102,
                "Price2": 95,
                "PriceOld": 110,
                "Unit": "ea",
                "Code": "corp-y"
            }
        ]
    }
}

Get the list of all labels in the Labels folder:

AzureLabelClipboardAPIRequest
/labels?encoding=utf-8&format=text

Server response

The program places a response on the clipboard, in which the first line is:

  • AzureLabelClipboardAPIAnswer::OK - if there is no error. The following lines are data from the program, if the request meant receiving data from the program.
  • AzureLabelClipboardAPIAnswer::ERROR - in case of an error. The following lines are a description of the error.