帮你快速理解、总结文档立即下载

蓝牙设备上报事件

最近更新时间:2024-10-11 18:26:02
我的收藏

1. 接口描述

接口请求域名: iot.cloud.tencent.com/api/exploreropen/tokenapi。 本接口(AppReportDeviceEvent)用于蓝牙设备通过 App 或小程序上报事件。

2. 输入参数

名称
类型
必选
描述
AccessToken
String
是
公共参数,AccessToken 用于对一个已经登录的用户鉴权。
RequestId
String
是
公共参数,唯一请求 ID,可自行生成,推荐使用 uuid。定位问题时,需提供该次请求的 RequestId。
Action
String
是
公共参数,本接口取值:AppReportDeviceEvent。
DeviceId
String
是
设备 ID,由 ProductId/DeviceName 拼接组成。
EventId
String
是
事件 ID。
Params
String
是
JSON 格式的 Event 参数。
Method
String
是
上报方法,可以是 ReportEventAsDevice、reported(默认)。
EventTimeStamp
Int64
是
Unix 毫秒级时间戳。

3. 输出参数

名称
类型
描述
RequestId
String
公共参数,唯一请求 ID,可自行生成,推荐使用 uuid。定位问题时,需提供该次请求的 RequestId。

4. 示例

输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1
content-type: application/json
{
"RequestId": "123e4567-e89b-12d3-a456-426614174000",
"Action": "AppReportDeviceEvent",
"DeviceId": "QD****BNB/dev01",
"EventId": "low_voltage",
"Params": "{\\"voltage\\":3.1}",
"Method": "ReportEventAsDevice",
"AccessToken": "ningtoken*******"
}
输出示例: 成功
{
"Response": {
"Data": "",
"RequestId": "123e4567-e89b-12d3-a456-426614174000"
}
}

5. 错误码

错误码
描述
InternalError
内部错误。
InvalidParameterValue
参数取值错误。
InvalidParameterValue.BindDeviceNotConnected
设备近期没有连接到云。
InvalidParameterValue.InvalidAccessToken
Token 无效。