1. 接口描述
接口请求域名:
iot.cloud.tencent.com/api/exploreropen/tokenapi
。
本接口(AppReportOTAStatus)用于上报设备固件升级状态及进度。2. 输入参数
名称 | 类型 | 必选 | 描述 |
AccessToken | String | 是 | 公共参数,AccessToken 用于对一个已经登录的用户鉴权。 |
RequestId | String | 是 | 公共参数,唯一请求 ID,可自行生成,推荐使用 uuId。定位问题时,需提供该次请求的 RequestId。 |
Action | String | 是 | 公共参数,本接口取值:AppReportOTAStatus。 |
ProductId | String | 是 | 产品 ID。 |
DeviceName | String | 是 | 设备名称。 |
Version | String | 是 | 固件升级的目标版本。 |
State | String | 是 | 固件升级状态: downloading:下载中。 fail:升级失败。 done:升级成功。 burning:烧录中。 updating:更新中。 |
ResultCode | Int | 是 | 错误码: 0:成功。 -1:下载超时。 -2:文件不存在。 -3:签名过期。 -4:MD5 不匹配。 -5:更新固件失败。 |
ResultMsg | String | 否 | 错误附加信息,当 State 取值为 fail 时必填。 |
Persent | Int | 否 | 升级进度百分比,取值范围 0 ~ 100。 |
3. 输出参数
名称 | 类型 | 描述 |
RequestId | String | 公共参数,唯一请求 ID,与入参相同,定位问题时,需提供该次请求的 RequestId。 |
4. 示例
示例1
输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1content-type: application/json{"AccessToken": "871d2d42****************692afae0","Action": "AppReportOTAStatus","RequestId": "584406e9-bf59-46a3-8d45-39f1891bed7b","ProductId": "PR******ID","DeviceName": "de***01","State": "done","ResultCode": 0,"ResultMsg": "","Version": "1.1","Persent": 100}
输出示例: 成功
{"Response": {"RequestId": "584406e9-bf59-46a3-8d45-39f1891bed7b"}}
示例2
输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1content-type: application/json{"AccessToken": "871d2d42****************692afae0","Action": "AppReportOTAStatus","RequestId": "584406e9-bf59-46a3-8d45-39f1891bed7b","ProductId": "PR******ID","DeviceName": "de***01","State": "downloading","ResultCode": 0,"ResultMsg": "","Version": "2.0","Persent": 20}
输出示例: 成功
{"Response": {"RequestId": "584406e9-bf59-46a3-8d45-39f1891bed7b"}}
5. 错误码
错误码 | 描述 |
InternalError | 内部错误。 |
InvalidParameterValue | 参数取值错误。 |
InvalidParameterValue.InvalidAccessToken | Token 无效。 |
InvalidParameterValue.NoPermission | 用户对该设备无权限。 |