Search Device Upgrade¶
查询设备的固件信息及升级状态。
操作权限¶
需授权的资源 |
所需操作权限 |
---|---|
设备管理 |
Read |
请求格式¶
POST https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=searchDeviceUpgrade
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|---|
orgId |
Query |
必需 |
String |
资产所属的组织 ID。 如何获取 orgId 信息>> |
请求参数(Body)¶
名称 |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|
expression |
可选 |
String |
查询表达式,支持类 SQL 的查询。目前支持查询的字段是
|
pagination |
可选 |
Pagination 请求结构体 |
分页参数。如未指定,默认每页10条。每页最大记录数为200条,但为获得最佳性能,建议每页不超过50条。不支持使用 |
响应参数¶
名称 |
数据类型 |
描述 |
---|---|---|
data |
DeviceFirmware 结构体数组 |
设备的固件的详情列表,DeviceFirmware 结构体的结构参见下表。 |
DeviceFirmware 结构体¶
名称 |
数据类型 |
描述 |
---|---|---|
orgId |
String |
资产所属的组织 ID。 |
assetId |
String |
资产的 ID。 |
productKey |
String |
设备的 product key。 |
deviceKey |
String |
设备的 device key。 |
firmwareVersion |
String |
设备的固件版本 |
isUpgrading |
Boolean |
设备固件升级的状态。 |
错误码¶
有关错误码的描述,参见 通用错误码。
示例¶
请求示例¶
url: https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=searchDeviceUpgrade&orgId=yourOrgId
method: POST
requestBody:
{
"expression": "productKey='yourProductKey'",
"pagination": {
"pageNo": 1,
"pageSize": 5
}
}
返回示例¶
{
"code":0,
"msg":"OK",
"requestId":"7bd0040b-63c6-4173-b764-d2e8d6642dd3",
"data":[
{
"orgId":"o15475466766371",
"assetId":"rFFJ6j53",
"productKey":"8UhOTwV5",
"deviceKey":"WnszKfi8NU",
"firmwareVersion":"7777",
"isUpgrading":false
},
{
"orgId":"o15475466766371",
"assetId":"qOE2FZb5",
"productKey":"BXwU4kMk",
"deviceKey":"ota-device2",
"firmwareVersion":"2.0",
"isUpgrading":true
},
{
"orgId":"o15475466766371",
"assetId":"kYK5nVJv",
"productKey":"8UhOTwV5",
"deviceKey":"bCUsvJvEBT",
"firmwareVersion":"2020.01",
"isUpgrading":false
},
{
"orgId":"o15475466766371",
"assetId":"VeHlM7wW",
"productKey":"8UhOTwV5",
"deviceKey":"1HshYDJ3wf",
"firmwareVersion":"2020.01",
"isUpgrading":false
},
{
"orgId":"o15475466766371",
"assetId":"TGEIuAWG",
"productKey":"8UhOTwV5",
"deviceKey":"bfb1EcjaKG",
"firmwareVersion":"7.7",
"isUpgrading":false
}
],
"pagination":{
"sortedBy":null,
"pageNo":1,
"pageSize":5,
"totalSize":9
}
}
Java SDK 调用示例¶
package com.envisioniot.enos.connect_service.ota.firmware;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.api.common.constant.request.Pagination;
import com.envisioniot.enos.connect_service.v2_1.ota.firmware.SearchDeviceUpgradeRequest;
import com.envisioniot.enos.connect_service.v2_1.ota.firmware.SearchDeviceUpgradeResponse;
public class SearchDeviceUpgrade {
public static void main(String[] args) {
final String appKey = "yourAppKey";
final String appSecret = "yourAppSecret";
String serverUrl = "yourServerUrl";
String orgId = "yourOrgId";
SearchDeviceUpgradeRequest request = new SearchDeviceUpgradeRequest();
request.setOrgId(orgId);
request.setExpression("productKey='yourProductKey'");
Pagination pagination = new Pagination();
pagination.setPageNo(1);
pagination.setPageSize(5);
request.setPagination(pagination);
SearchDeviceUpgradeResponse response = Poseidon
.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
.url(serverUrl)
.getResponse(request, SearchDeviceUpgradeResponse.class);
}
}