Search OTA Job¶
Search for OTA jobs 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-jobs?action=search
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 |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
---|---|---|---|
expression |
Optional |
String |
The query expression, which supports sql-like query. The supported query fields are as per the below.
|
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. When not specified, 10 records are displayed per page by default and sorted in descending order by |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
JobInfo Struct |
The details of the OTA job. For more information, see JobInfo Struct>> |
Error Codes¶
For the description of error codes, see Common Error Codes.
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/ota-jobs?action=search&orgId=yourOrgId
method: POST
requestBody:
{
"expression":"productKey='yourProductKey'",
"pagination":{
"pageNo":1,
"pageSize":5
}
}
Return Sample¶
{
"code":0,
"msg":"OK",
"requestId":"99344e67-c79b-46bd-91d1-3ce3503ae769",
"data":[
{
"orgId":"o15475466766371",
"productKey":"BXwU4kMk",
"jobId":"5ed758ca49f032b4663063aa",
"name":{
"defaultValue":"name",
"i18nValue":{
}
},
"firmwareId":"5ed0dd4a646542001b3d113f",
"type":"upgrade",
"enableUpgradeRequest":true,
"upgradePolicy":null,
"upgradeScope":{
"type":"total",
"versionNumbers":[
"1.0"
],
"deviceKeys":null,
"attributes":null,
"tags":null,
"assetTrees":null
},
"upgradeTimeout":7200,
"startSchedule":0,
"endSchedule":86399,
"status":"started",
"createTime":1591171274788,
"startAfterCreate":true
},
{
"orgId":"o15475466766371",
"productKey":"BXwU4kMk",
"jobId":"5ed0e177646542001b3d114d",
"name":null,
"firmwareId":"5ed0dd4a646542001b3d113f",
"type":"verify",
"enableUpgradeRequest":true,
"upgradePolicy":null,
"upgradeScope":{
"type":"partial",
"versionNumbers":[
"1.0"
],
"deviceKeys":[
"ota-device1"
],
"attributes":null,
"tags":null,
"assetTrees":null
},
"startSchedule":0,
"endSchedule":86399,
"status":"stopped",
"createTime":1590747511198,
"startAfterCreate":null
},
{
"orgId":"o15475466766371",
"productKey":"BXwU4kMk",
"jobId":"5ed0de47646542001b3d1145",
"name":null,
"firmwareId":"5ed0dd4a646542001b3d113f",
"type":"verify",
"enableUpgradeRequest":true,
"upgradePolicy":null,
"upgradeScope":{
"type":"partial",
"versionNumbers":[
"1.0"
],
"deviceKeys":[
"ota-device1"
],
"attributes":null,
"tags":null,
"assetTrees":null
},
"startSchedule":0,
"endSchedule":86399,
"status":"stopped",
"createTime":1590746695872,
"startAfterCreate":null
},
{
"orgId":"o15475466766371",
"productKey":"BXwU4kMk",
"jobId":"5ed0dd8c646542001b3d1140",
"name":null,
"firmwareId":"5ed0dd4a646542001b3d113f",
"type":"verify",
"enableUpgradeRequest":true,
"upgradePolicy":null,
"upgradeScope":{
"type":"partial",
"versionNumbers":[
"1.0"
],
"deviceKeys":[
"ota-device1"
],
"attributes":null,
"tags":null,
"assetTrees":null
},
"upgradeTimeout":7200,
"startSchedule":0,
"endSchedule":86399,
"status":"stopped",
"createTime":1590746508060,
"startAfterCreate":null
}
],
"pagination":{
"sortedBy":null,
"pageNo":1,
"pageSize":5,
"totalSize":4
}
}
Java SDK Sample¶
package com.envisioniot.enos.connect_service.ota.job;
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.job.SearchJobRequest;
import com.envisioniot.enos.connect_service.v2_1.ota.job.SearchJobResponse;
public class SearchJob {
public static void main(String[] args) {
final String appKey = "yourAppKey";
final String appSecret = "yourAppSecret";
String serverUrl = "yourServerUrl";
String orgId = "yourOrgId";
SearchJobRequest request = new SearchJobRequest();
request.setOrgId(orgId);
request.setExpression("firmwareId='yourFirmwareId'");
Pagination pagination = new Pagination();
pagination.setPageNo(1);
pagination.setPageSize(5);
request.setPagination(pagination);
SearchJobResponse response = Poseidon
.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
.url(serverUrl)
.getResponse(request, SearchJobResponse.class);
}
}