Historical Event Integration


For non-passthrough mode, the third-party system needs to generate data as per the standard format defined in EnOS Cloud (currently JSON) and then report these data.


Upstream

  • Request TOPIC: sys/${productKey}/integration/event/post

  • Response TOPIC: sys/${productKey}/integration/event/post_reply

Sample Request Format

{
    "id":"123",
    "version":"1.0",
    "params":[
        {
            "deviceKey":"device1",
            "events":{
                "eventId1":{
                    "alarm":9,
                    "level":3
                }
            },
            "time":123456
        },
        {
            "deviceKey":"device2",
            "events":{
                "eventId2":{
                    "result":"ok"
                }
            },
            "time":123456
        }
    ],
    "method":"integration.event.post"
}

Sample Response Format

{
    "id": "123",
    "code": 200,
    "data": {}
}

Request Parameter Description

Parameters

Type

Mandatory/Optional

Description

id

Long

Optional

The message ID. It is a reserved parameter that is reserved for future use.

version

String

Mandatory

The version of the protocol. The current version is 1.0.

params

Array

Mandatory

The parameters for the reported events.

deviceKey

String

Mandatory

The device key.

events

Object

Mandatory

The list of the identifiers for the events to be reported.

eventId1

String

Mandatory

The identifier of the event that you want to report. In this example, the event has the identifier eventId1. The value you set for the event must match the data type defined for this parameter. In this case, the data type for eventId1 is struct, defined with 2 paramters alarm and level.

alarm

Integer

Optional

The parameter name of the struct data type of the event eventId1. The value you set must match the data type defined for this parameter. For example, when the data type of this parameter is set to integer in the model, the value here must be an integer.

level

Integer

Optional

The parameter name of the struct data type of the event eventId1. Similar to the above, the value you set must match the data type defined for this parameter.

result

String

Optional

The parameter name of the struct data type of the event eventId2. Similar to the above, the value you set must match the data type defined for this parameter.

time

String

Optional

The timestamp of the event. If not specified, the timestamp will be set as the server time.

method

String

Optional

The request method.

Response Parameter Description

Parameter

Type

Mandatory/Optional

Description

code

Integer

Mandatory

The return code. “200” indicates that the request operation is executed successfully.

data

String

Optional

The detailed returned information in JSON format.

Return Code

Return Code

Error Message

Explanation

1204

Model validate failed

events contains invalid fields.

1257

Device not found

The device does not exist.