Send commands

Last Updated on : 2023-06-19 07:06:07

Send commands to a device.

API address

POST: /v1.0/iot-03/devices/{device_id}/commands

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueDevice ID

Description of body

Parameter nameTypeINRequiredDescription
commandsList trueThe command to control a device

Description of commands

Parameter nameTypeINRequiredDescription
codeString trueCommand code
valueObject trueCommand value

Return parameter

Parameter nameTypeDescription
resultBoolean

Request example

POST: /v1.0/iot-03/devices/xxxid/commands
{
  "commands": [
    {
      "code": "switch_led",
      "value": true
    }
  ]
}

Return example

{
    "result": true,
    "t": 1551851043862,
    "success": true
}

Error code

For more information, see error code.