Device command

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.

Request Syntax

POST /v1/synccmds?device_id=524092364&timeout=30

<command-content>

URL Parameter Description

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.

Body Description

Request Body refers to user-defined command data content.

Return Syntax

Content-type: application/json

{
    "errno": 0,
    "error": "success",
    "data": {
        "cmd_uuid": "f9115090-8ef1-4b0c-aaf4-0678754f575a",
        "cmd_resp": "dGhpcyUyMGlzJTIwY29tbWFuZC1yZXNwb25zZSUyMGNvbnRlbnQ="
    }
}

Return Parameter Description

Name Type Description
errno int Error Code
error string Error Description
cmd_uuid string Command ID
cmd_resp string Response content, base64 encoded

Return Error Codes

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"
}

Usage restrictions

  • Command request body size must be less than 1k.
  • In a device response, payload size must be less than 1k.

More help

个搜索结果,搜索内容 “

    0 个搜索结果,搜索内容 “