Send commands

Last Updated on : 2024-09-10 01:49:18

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.