Send Actions

Last Updated on : 2024-06-29 00:55:46download

Based on the device ID, immediately send an action command to the specified device. When the device is offline, the sending process will fail.

API address

POST: /v2.0/cloud/thing/{device_id}/shadow/actions

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringpathtrueThe device ID.

Description of body

Parameter nameTypeINRequiredDescription
codeStringbodytrueThe code of the specified device action.
input_paramsStringbodytrueThe properties of the supported actions and the value of an action that is sent from the cloud to the device. In JSON parsable data, the key is the code obtained by querying the action, and the value is the action value to be changed.

Return parameter

Parameter nameTypeDescription
resultJSONThe returned result. Ignore for now.
successBooleanIndicates whether the operation is successful. Valid values:
  • true: The operation succeeded.
  • false: The operation failed.
tLongThe timestamp.
tidStringThe link ID.

Request example

POST: /v2.0/cloud/thing/2132131*****/shadow/actions
{
  "code": "action",
  "input_params": "{\"color\":\"red\",\"name\":\"text\"}"
}

Return example

{
    "tid": "77a9807fb74411edb9d75a827c79edfd",
    "result": {
    },
    "t": 1677574021435,
    "success": true
}

Error code

For more information, see error code.

Limits on API Request Frequency

For more information, see Limits on API Request Frequency.