The platform provides device command APIs for directly sending unicast commands to devices. API is designed synchronously, that is, when a device receives and responds to a command, API returns the response content.
POST /v1/synccmds?device_id=524092364&timeout=30
<command-content>
Version | Type | Required or not | Description |
---|---|---|---|
device_id | string | Yes | Device ID |
timeout | string | Yes | Maximum wait time for a synchronous API, ranging from 5-30 seconds. |
Request Body refers to user-defined command data content.
Content-type: application/json
{
"errno": 0,
"error": "success",
"data": {
"cmd_uuid": "f9115090-8ef1-4b0c-aaf4-0678754f575a",
"cmd_resp": "dGhpcyUyMGlzJTIwY29tbWFuZC1yZXNwb25zZSUyMGNvbnRlbnQ="
}
}
Name | Type | Description |
---|---|---|
errno | int | Error Code |
error | string | Error Description |
cmd_uuid | string | Command ID |
cmd_resp | string | Response content, base64 encoded |
Error Codes | Error Description | Description |
---|---|---|
12 | device not found | Device is not found |
13 | device not online | Device is offline |
14 | cmd response timeout | Command response timeout |
Example of the returned error:
{
"errno": 14,
"error": "cmd response timeout"
}