V2.1 Search OTA Job


Search for OTA jobs based on the search criteria.


This API is available in EnOS 2.2.0 and above.

If you need to invoke this API after performing bulk updates to relevant OTA jobs using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.

Operation Permissions


Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.


Required Service Required Operation Permission
Firmware Read OTA

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.

  • productKey, firmwareId, and firmwareVersion: supports arithmetic operators “=” and “in”.

  • type and status: supports arithmetic operator “=”.

  • firmwareName and name: supports fuzzy inquiry of the specified language.

    • firmwareName like ‘xxx’ and name like ‘xxx’: fuzzy inquiry of the default name, Chinese name, and English name.
    • firmwareName.defaultValue like ‘xxx’ and name.defaultValue like ‘xxx’: fuzzy inquiry of the default name.
    • firmwareName.zh_CN like 'xxx' and name.zh_CN like 'xxx': fuzzy inquiry of the Chinese name. If no Chinese name exists, fuzzy inquiry of default name.
    • firmwareName.en_US like 'xxx' and name.en_US like 'xxx': fuzzy inquiry of the English name. If no English name exists, fuzzy inquiry of default name.
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 createTime. The maximum records per page is 200 but for optimal performance, it is recommended to have not more than 50 records per page. sorters is not supported to sort the response. For more details, see Pagination Request Struct.

Response Parameters

Note

For old firmware files, return product information. For new firmware files, do not return product information.

Name Data Type Description
data JobInfo Struct The details of the OTA job. For more information, see JobInfo Struct.

Error Codes

Code Message Description
99400 Do not allow operator op =, allowed op [like] The syntax used in expression is not supported.


For other 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:
//example 1
{
    "expression":"productKey='yourProductKey'",
    "pagination":{
        "pageNo":1,
        "pageSize":5
    }
}

//example 2
{
  "expression": "firmwareName like 'firmware1'",
  "pagination": {
      "pageNo": 1,
      "pageSize": 5
  }
}

//example 3
{
  "expression": "name like 'name' and firmwareName like 'firmware1'"
}

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"99344e67-c79b-46bd-91d1-3ce3503ae769",
    "data":[
        {
            "orgId":"yourOrgId",
            "productKey":"yourProductKey",
            "jobId":"yourJobId",
            "name":{
                "defaultValue":"name",
                "i18nValue":{
                  "en_US":"name",
                  "zh_CN":"中文名",
                  "es_ES":"nombre",
                  "ja_JP":"名前"
        }
            },
            "firmwareId":"5ed0dd4a646542001b3d113f",
            "firmwareVersion":"1.1.0",
            "firmwareName":{
                "defaultValue":"firmware1",
                "i18nValue":{

                }
            },
            "type":"upgrade",
            "enableUpgradeRequest":true,
            "upgradePolicy":null,
            "upgradeScope":{
                "type":"total",
                "versionNumbers":[
                    "1.0"
                ],
                "deviceKeys":null,
                "attributes":null,
                "tags":null,
                "assetTrees":null
            },
            "upgradeTimeout":7200,
            "startSchedule":null, //deprecated
            "endSchedule":null, //deprecated
            "status":"started",
            "createTime":1591171274788
        }
    ],
    "pagination":{
        "sortedBy":null,
        "pageNo":1,
        "pageSize":5,
        "totalSize":1
    }
}

SDK Samples


You can access the SDK samples for Connection Service on GitHub: