English
English
简体中文
Contact Us
Register
Log In

Report Device Event

Last Updated on : 2022-05-05 10:00:57

Report the event of a 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 a Tuya device.

Description of body

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

Description of data

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

Return parameter

Parameter nameTypeDescription
resultBooleanThe returned result.
codeBooleanThe response code. It is empty when the operation succeeded.
msgStringThe error message if the API call fails. It is empty if the operation succeeded.
successBooleanIndicates whether the operation 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.