Message Push Interface
Subscribe device attribute
API intent: config.resource.subscribe
Description: When the device status changes, the corresponding attribute data will be reported to Lumi Cloud. If the developer has configured the message push function, then Lumi Cloud will push the device data to the third-party server. Due to the huge amount of device data, if you do not need to receive all the device data, the developer can specify the device attribute data to be received through the subscription attribute interface.
Subscription attributes need to be used with the message push function. For detailed message push function descriptions, please refer to message push.
Request parameters
Name | Type | Is required? | Description |
---|---|---|---|
resources | List | Yes | Resource list |
Resources description
Name | Type | Is required? | Description |
---|---|---|---|
subjectId | String | Yes | Subject id |
resourceIds | Array(String) | Yes | Device attribute, see device attribute page. |
attach | String | No | Additional information |
- Request Demo
{
"intent": "config.resource.subscribe",
"data": {
"resources": [
{
"subjectId": "virtual2.11774113824794",
"resourceIds": [
"4.1.85"
],
"attach":"haha"
}
]
}
}
Response parameters: NA
Response demo
{
"code": 0,
"message": "Success",
"msgDetails": "",
"requestId": "",
"result": null
}
Unsubscribe device attribute
- API intent: config.resource.subscribe
- Description: Cancel the resource ID subscription of the specified device.
- Request parameters
Name | Type | Is required? | Description |
---|---|---|---|
resources | List | Yes | Resource list |
Resources description
Name | Type | Is required? | Description |
---|---|---|---|
subjectId | String | Yes | Subject id |
resourceIds | Array | Yes | Device attribute, see device attribute page. |
- Request Demo
{
"intent": "config.resource.unsubscribe",
"data": {
"resources": [
{
"subjectId": "virtual2.11774113824794",
"resourceIds": [
"4.1.85"
]
}
]
}
}
Response parameters: NA
Response demo
{
"code": 0,
"message": "Success",
"msgDetails": "",
"requestId": "",
"result": null
}
Query the details of the failed message
- API intent: query.push.errorMsg
- Description: This interface is used to query the details of the message data that failed to push. Only supports querying within the past 12 hours.
- Request parameters
Name | Type | Is required? | Description |
---|---|---|---|
appId | String | Yes | Application id |
openId | String | No | Authorized user's unique identifier |
msgType | String | No | Message Type. 0-Event notification message 1-Attribute Message |
startTime | Long | No | The start timestamp, defaults to the current time 12 hours ago |
endTime | Long | No | The end timestamp, defaults to the current time |
size | Integer | No | The amount of data pulled each time |
scanId | String | No | The scanId returned by the last request, if not passed, the query will start from the beginning of the data |
- Request parameters
{
"intent": "query.push.errorMsg",
"data": {
"appId":"8971234912asd32",
"openId": "78321978321123",
"msgType": "resource_report",
"startTime": 1612321342000,
"endTime": 167845478000,
"size": 1,
"scanId":"81237821323"
}
}
- Response parameters
Name | Type | Description |
---|---|---|
appId | String | Application id |
openId | String | Authorized user's unique identifier |
pushTime | Integer | Push time |
content | Integer | Push content |
msgType | Integer | Message Type. 0-Event notification message 1-Attribute Message |
- Response demo
{
"code": 0,
"requestId": "",
"message": "Success",
"msgDetails": null,
"result": {
"scanId": "12376127632232",
"msg": [
{
"appId": "85729407462685491210c04a",
"openId": "352922007642857296055698141185",
"pushTime": 1625046378517,
"content": "{\"data\":[{\"resourceId\":\"4.1.85\",\"statusCode\":0,\"subjectId\":\"virtual2.63697334426607\",\"time\":\"1625046376627\",\"triggerSource\":{\"time\":\"1625046376\",\"type\":4},\"value\":\"0\"}],\"msgId\":\"AC120001000A18B4AAC29928A0E82DD41\",\"msgType\":\"resource_report\",\"openId\":\"352922007642857296055698141185\",\"time\":\"1625046378516\"}",
"msgType": resource_report
}
]
}
}