1. 接口描述
接口请求域名:
iot.cloud.tencent.com/api/exploreropen/tokenapi
。
本接口(AppGetMessages)用于查询消息列表,消息包括设备告警消息、操作通知消息。2. 输入参数
名称 | 类型 | 必选 | 描述 |
AccessToken | String | 是 | 公共参数,AccessToken 用于对一个已经登录的用户鉴权。 |
RequestId | String | 是 | 公共参数,唯一请求 ID,可自行生成,推荐使用 uuid。定位问题时需要提供该次请求的 RequestId。 |
Action | String | 是 | 公共参数,本接口取值:AppGetMessages。 |
Category | Int64 | 是 | 主类型。 1:设备。 2:家庭。 3:通知。 |
MsgID | String | 否 | 消息 ID,首次可不传。 |
MsgTimestamp | Int64 | 否 | 消息的时间戳,首次可不传或传0。 |
Limit | Int64 | 是 | 最大返回条数,最大不超过100。 |
3. 输出参数
名称 | 类型 | 描述 |
RequestId | String | 公共参数,唯一请求 ID,与入参相同,定位问题时,需提供该次请求的 RequestId。 |
Listover | String | 用于翻页。 |
4. 示例
输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1content-type: application/json{"Action": "AppGetMessages","RequestId": "f92406b3-5a9a-4fe8-bc43-45e3d794bb68","AccessToken": "8b******************b8ec","Category": 2,"MsgID": "","MsgTimestamp": 0,"Limit": 5}
输出示例:成功
{"Response": {"Data": {"Listover": true,"Msgs": [{"UserID": "1","FromUserID": "","MsgID": "65167410520395776","Category": 1,"MsgType": 100,"MsgTitle": "Device Warning","MsgContent": "Some message Wed Nov 27 2019 11:52:01 GMT+0000.","MsgTimestamp": 1574855521420,"ProductId": "","DeviceName": "","DeviceAlias": "","FamilyId": "","FamilyName": "","RelateUserID": "","CreateAt": "2019-11-27T11:52:01.42Z"}, {"UserID": "1","FromUserID": "1","MsgID": "65167395785805824","Category": 2,"MsgType": 200,"MsgTitle": "成员添加结果通知","MsgContent": "“jordan”将“dylan”添加为“深圳的家”的成员,成员可以查看和控制家里的智能设备。 Wed Nov 27 2019 11:51:57 GMT+0000","MsgTimestamp": 1574855517907,"ProductId": "","DeviceName": "","DeviceAlias": "","FamilyId": "1","FamilyName": "test","RelateUserID": "2","CreateAt": "2019-11-27T11:51:57.907Z"}, {"UserID": "1","FromUserID": "1","MsgID": "65167386239569920","Category": 2,"MsgType": 201,"MsgTitle": "成员删除结果通知","MsgContent": "“jordan”将“dylan”从“深圳的家”中删除,删除后将不能查看和控制家中的智能设备。 Wed Nov 27 2019 11:51:54 GMT+0000","MsgTimestamp": 1574855515631,"ProductId": "","DeviceName": "","DeviceAlias": "","FamilyId": "1","FamilyName": "test","RelateUserID": "2","CreateAt": "2019-11-27T11:51:55.631Z"}, {"UserID": "1","FromUserID": "1","MsgID": "65167339519217664","Category": 3,"MsgType": 300,"MsgTitle": "设备分享结果通知","MsgContent": "“dylan”已成功接收“jordan”分享的设备“智能灯”,现在可以查看和控制设备了。 Wed Nov 27 2019 11:51:44 GMT+0000","MsgTimestamp": 1574855504492,"ProductId": "22F9Y6II7O","DeviceName": "light1","DeviceAlias": "light1","FamilyId": "","FamilyName": "","RelateUserID": "2","CreateAt": "2019-11-27T11:51:44.492Z"}]},"RequestId": "f92406b3-5a9a-4fe8-bc43-45e3d794bb68"}}
5. 错误码
错误码 | 描述 |
InternalError | 内部错误。 |
InvalidParameterValue | 参数取值错误。 |
InvalidParameterValue.InvalidAccessToken | Token 无效。 |