exec_cmd
To send a command to a unit, use the unit/exec_cmd method.
Endpoint
svc=unit/exec_cmd¶ms={
"itemId": <long>,
"commandName": "<text>",
"linkType": "<text>",
"param": "<text>",
"timeout": <uint>,
"flags": <uint>
}
Parameters
The required parameters are marked with an asterisk (*).
| Parameter | Description |
|---|---|
itemId* |
Unit ID. |
commandName* |
Command name. |
linkType* |
Link type (see unit/update_command_definition). If the link type is specified in the command properties, the command is sent over that link type, and the value of this parameter is ignored. If the link type is empty both in the request and in the command properties, the link type is selected automatically from those over which the command is currently available. |
param* |
Command parameters. If the command has no parameters, specify an empty string. If the parameters are specified in the command properties, they’re used, and the value of this parameter is ignored. |
timeout* |
Timeout for the command to be in the command queue, in seconds. |
flags |
Flags for selecting a phone number to execute the command:
|
Response
If the request is completed successfully, an empty object is returned:
{}
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters, for example, one of the required parameters is missing. |
| 5 | Failed to execute the command. This error is returned in the following cases:
|
| 7 | The unit doesn’t exist, or the user doesn’t have the Send commands access right to it. |