Report Device Event

Last Updated on : 2023-06-20 12:39:05

Report an event of the specified device in the form of an instant message. A message can contain multiple output parameters that need to be perceived and processed externally.

API address

POST: /v1.0/iot-03/3rdcloud/devices/{device_id}/event/report

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueThe ID of the specified Tuya-enabled device.

Description of body

Parameter nameTypeINRequiredDescription
msg_idStringbodytrueThe unique identifier of the specified request. The length should not exceed 32 characters.
dataObjectbodytrueThe output parameter for the specified event.

Description of data

Parameter nameTypeINRequiredDescription
event_codeStringbodytrueThe event code as a functional identifier.
event_timeLongbodytrueThe 13-digit standard timestamp when an event occurs.
output_paramsObjectbodyfalseThe output parameter for the specified event.

Return parameter

Parameter nameTypeDescription
resultBooleanThe response result.
codeStringThe response code. It is empty when the request succeeded.
msgStringThe message that is returned if the request fails. It is empty if the request is successful.
successBooleanIndicates whether the request is successful. Valid values:
  • true: success.
  • false: failure.
tLongThe 13-digit timestamp of a response.

Request example

POST: /v1.0/iot-03/3rdcloud/devices/6cf4171005d11e2ca7****/event/report
{
  "msg_id": "ed23rty159292****",
  "data": {
    "event_code": "read_face",
    "event_time": 1592920221212,
    "output_params": {
      "sex": "man",
      "age": 23
    }
  }
}

Return example

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

Error code

For more information, see error code.