get_hw_cmds
To get the list of commands available for a unit or a device type, or to get the command templates, use the core/get_hw_cmds method.
svc=core/get_hw_cmds¶ms={
"deviceTypeId": <long>,
"unitId": <long>,
"template": <bool>,
"lang": "<text>"
}
Parameters
| Parameter | Description |
|---|---|
| deviceTypeId | Device type ID. |
| unitId | Unit ID. |
| template | Flag. If set to 1, the response contains a JSON with the command template data. The parameter is optional. |
| lang | Language into which the values of title and label are translated. The parameter is optional. |
You can specify only one of the deviceTypeId and unitId parameters or both. The search begins with the device type ID and, if it fails, continues with the unit ID. If you want to omit a parameter, set it to 0.
Response
If template is 0 or not specified, the response contains the list of available commands:
{
"<text>": [ /* Link type: GSM, TCP, UDP, VRT. */
"<text>", /* Command type. */
...
],
...
}
If template is 1, the command template is returned. It can contain a custom set of fields. An example of a JSON is given below:
{
"<cmd_template_name>": { /* Name. */
"icon": <text>, /* Icon. */
"props": [ /* Properties. */
{
"label": <text>, /* Property label. */
"type": <text>, /* Type. */
"validate": <text>, /* Validation rule. */
"value": [ /* Key-value array. */
{
"n": <text>, /* Key. */
"v": <text> /* Value. */
},
...
],
"default": <text>, /* Default value (for example, the IP address port). */
"title": <text>, /* Title. */
"maxlength": <uint> /* Maximum length. */
},
...
]
},
...
}
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | One of the following errors:
|
| 6 | Failed to fetch the current user. |