update_command_definition

To create, edit or delete a command, use the unit/update_command_definition method.

Copied!
svc=unit/update_command_definition&params={
    "itemId": <long>,
    "id": <long>,
    "callMode": <text>,
    "n": <text>,
    "c": <text>,
    "l": <text>,
    "p": <text>,
    "a": <long>
}

Parameters

If you want to create or edit a command, the request must contain the following parameters:

Parameter Description
itemId Unit ID.
id Command ID.
callMode Required action. For creation, specify create, for editing, update.
n Command name.
c Command type (see below).
l Link type (see below).
p Parameters.
a Access rights that the user must have to execute this command (see check_items_billing ).

Command types

Value Command type
block_engine Block the engine
unblock_engine Unblock the engine
custom_msg Send a custom message
driver_msg Send a message to the driver
download_msgs Download messages
query_pos Request coordinates
query_photo Request a photo
output_on Activate an output
output_off Deactivate an output
send_position Send coordinates
set_report_interval Set a data transfer interval
upload_cfg Upload the configuration
upload_sw Upload the firmware

Link types

Value Link Type
Empty string Auto
tcp TCP
udp UDP
vrt Virtual
gsm SMS

If you want to create a command by copying it from another unit, the request must contain the following parameters:

Parameter Description
itemId Unit ID.
id Command ID.
callMode Required action. For creation, specify create.
oldItemId ID of the unit from which you want to copy the command.
oldCmdId ID of the command you want to copy

If you want to delete a command, the request must contain the following parameters:

Parameter Description
itemId Unit ID.
id Command ID.
callMode Required action. For deletion, specify delete.

Response

If the request to create or edit a command is completed successfully, a response in the following format is returned:

Copied!

[
    <long>,       /* Command ID. */
    {
        "id":<long>,  /* Command ID. */
        "n":<text>,   /* Command name. */
        "c":<text>,   /* Command type. */
        "l":<text>,   /* Link type. */
        "p":<text>,   /* Parameters. */
        "a":<uint>,   /* Access level. */
        "f":<uint>, /* Flags. */
        "jp":{...} /* JSON parameters (only if exist). */
    }
]

If the request to delete a command is completed successfully, a response in the following format is returned:

Copied!

[
    <long>,       /* Command ID. */
    null
]

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input format.
6 Failed to delete the command.

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

Your message was sent. Thank you!

Report a mistake

An error occurred while submitting the form

Download PDF file
Download Word document

See also