get_command_definition_data

To get the command definition data, use the unit/get_command_definition_data method.

Endpoint

Copied!
svc=unit/get_command_definition_data&params={
  "itemId": <long>,
  "col": [<long>]
}

Parameters

The required parameters are marked with an asterisk (*).

Parameter Description
itemId* Unit ID.
col Array of command IDs. If this parameter is specified, the response contains only the commands with these IDs, in the same order. IDs of nonexistent commands are skipped.

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
[
    {
        "id": <long>,   /* Command ID */
        "n": "<text>",  /* Command name */
        "c": "<text>",  /* Command type */
        "l": "<text>",  /* Link type. Empty if the link type is selected automatically */
        "p": "<text>",  /* Parameters */
        "a": <long>,    /* Access rights the user must have to execute the command */
        "f": <uint>,    /* Flags */
        "jp": "<text>"  /* JSON parameters as text. Empty if they aren't set */
    }
]

The a value is a combination of access flags. To execute the command, the user must have all these access rights to the unit in addition to the Send commands right. For example, 1 corresponds to the View object and its basic properties access right.

The command and link types, as well as the p and jp parameters, are described on the unit/update_command_definition page.

The response isn’t limited to the commands that the device can execute at the moment. To get only such commands, use the Available commands flag of the unit data format.

If the request fails, an error code is returned.

Error codes

Error code Description
4 The itemId parameter is missing or isn’t a number.
7 The unit doesn’t exist, or the user doesn’t have the View commands access right to it.

If you find a mistake in the text, please select it and press Ctrl+Enter.