Search Device Upgrade¶
Search for the firmware and upgrade status of the device based on the search criteria.
Operation Permissions¶
Required Authorization |
Required Operation Permission |
---|---|
Device Management |
Read |
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=searchDeviceUpgrade
Request Parameters (URI)¶
Name |
Location(Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
expression |
Optional |
String |
The query expression, which supports sql-like query. The fields that are supported for query include:
|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. When not specified, 10 records are displayed per page by default. The maximum records per page is 200 but for optimal performance, it is recommended to have not more than 50 records per page. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of DeviceFirmware Structs |
The list of firmware information. For details, see DeviceFirmware Struct>> |
DeviceFirmware Struct ¶
Name |
Data Type |
Description |
---|---|---|
orgId |
String |
The organization ID which the asset belongs to. |
assetId |
String |
The asset ID. |
productKey |
String |
The product key. |
deviceKey |
String |
The device key. |
firmwareVersion |
String |
The firmware version. |
isUpgrading |
Boolean |
|
Error Codes¶
For the description of error codes, see Common Error Codes.
Samples¶
Request Sample¶
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
}
}
Return Sample¶
{
"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 Sample¶
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);
}
}