get_hw_cmds

The get_hw_cmds function is used to get the list of commands available for a unit or a hardware type, or to get the command templates.

Copied!
svc=core/get_hw_cmds&params={"deviceTypeId":<long>,
			     "unitId":<long>,
			     "template":<bool>
			     "lang":"<text>"}

Parameters

NameDescription

deviceTypeId

Hardware type ID.

unitId

Unit ID.

template

Flag. If set to 1 (on), the returned result is a JSON with the command template data. The parameter is optional.

lang

Flag. Translates the values of "title" and "label" values. The parameter is optional.

You can set only one parameter or both. The search begins with the hardware type ID and if it fails, continues with the unit ID. If you want to omit a parameter, set it to 0.

Returned result

The returned result contains the list of available commands if template:0 or missing:

Copied!
{
	"<text>":[	/* link type: GSM, TCP, UDP, VRT */
		"<text>",	/* command type */
		...
	],
	...
}

If the template flag is set to 1, the command template is returned. It can be a custom set of fields. An example of a JSON is given below:

Copied!
{
  "<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>,    /* a default value (for example the IP address port) */
        "title":<text>,      /* title */
        "maxlength":<uint>   /* maximum length */
      },
      ...      
    ]
  },
  ...  
}

Possible error codes:

CodeDescription
6Failed to fetch the current user.
4

One of the following:

  • wrong input parameters;
  • failed to fetch the hardware by ID; 
  • failed to fetch the billing plan for the hardware.
Download PDF file
Download Word document

See also