Search Firmware File


Search for firmware files under an OU 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=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 Mandatory/Optional Data Type Description
expression Optional String

The query expression, which supports sql-like query. The supported query fields are as per the below.

  • productKey: supports arithmetic operators “=” and “in”.
  • isVerified: supports arithmetic operator “=”.
  • name: supports fuzzy inquiry of the specified language.
    • name like ‘xxx’: fuzzy inquiry of the default name, Chinese name, and English name.
    • name.default like ‘xxx’: fuzzy inquiry of the default name.
    • name.zh_CN like ‘xxx’: fuzzy inquiry of the Chinese name. If no Chinese name exists, fuzzy inquiry of default name.
    • 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

Name Data Type Description
data Array of FirmwareInfo Structs The list of firmwares. For details, see FirmwareInfo 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-firmwares?action=search&orgId=yourOrgId
method: POST
requestBody:
{
    "expression":"productKey='yourProductKey'",
    "pagination":{
        "pageNo":1,
        "pageSize":5
    }
}

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"dc5d94aa-b021-4631-9def-2404d02d30a5",
    "data":[
        {
            "orgId":"o15475466766371",
            "firmwareId":"5ede13577072bf001f23de83",
            "productKey":"BXwU4kMk",
            "name":{
                "defaultValue":"ota_subdevice",
                "i18nValue":{

                }
            },
            "version":"2.6",
            "desc":null,
            "signMethod":"md5",
            "sign":"12c696fa5c075e8687458fd6ce164b57",
            "fileUrl":"enos-connect://233f7744ad002000.zip",
            "fileSize":1767,
            "isVerified":false,
            "enableVerification":false,
            "createTime":1591612247588
        },
        {
            "orgId":"o15475466766371",
            "firmwareId":"5ed49964a19bac001bcdb84e",
            "productKey":"BXwU4kMk",
            "name":{
                "defaultValue":"validateTest",
                "i18nValue":{

                }
            },
            "version":"validate2.0",
            "desc":null,
            "signMethod":"md5",
            "sign":"12c696fa5c075e8687458fd6ce164b57",
            "fileUrl":"enos-connect://232cf5150d800000.zip",
            "fileSize":1767,
            "isVerified":true,
            "enableVerification":false,
            "createTime":1590991204702
        },
        {
            "orgId":"o15475466766371",
            "firmwareId":"5ed0ddb7646542001b3d1144",
            "productKey":"BXwU4kMk",
            "name":{
                "defaultValue":"validatetest",
                "i18nValue":{

                }
            },
            "version":"3.0",
            "desc":null,
            "signMethod":"md5",
            "sign":"12c696fa5c075e8687458fd6ce164b57",
            "fileUrl":"enos-connect://2325aa890e002000.zip",
            "fileSize":1767,
            "isVerified":true,
            "enableVerification":false,
            "createTime":1590746551873
        },
        {
            "orgId":"o15475466766371",
            "firmwareId":"5ed0dd4a646542001b3d113f",
            "productKey":"BXwU4kMk",
            "name":{
                "defaultValue":"HC_TEST",
                "i18nValue":{

                }
            },
            "version":"2.0",
            "desc":null,
            "signMethod":"md5",
            "sign":"12c696fa5c075e8687458fd6ce164b57",
            "fileUrl":"enos-connect://2325a9b338800000.zip",
            "fileSize":1767,
            "isVerified":false,
            "enableVerification":false,
            "createTime":1590746442378
        }
    ],
    "pagination":{
        "sortedBy":null,
        "pageNo":1,
        "pageSize":5,
        "totalSize":4
    }
}

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.SearchFirmwareFileRequest;
import com.envisioniot.enos.connect_service.v2_1.ota.firmware.SearchFirmwareFileResponse;

public class SearchFirmware {
    public static void main(String[] args) {
        final String appKey = "yourAppKey";
        final String appSecret = "yourAppSecret";
        String serverUrl = "yourServerUrl";

        String orgId = "yourOrgId";

        SearchFirmwareFileRequest request = new SearchFirmwareFileRequest();
        request.setOrgId(orgId);

        request.setExpression("productKey='yourProductKey'");

        Pagination pagination = new Pagination();
        pagination.setPageNo(1);
        pagination.setPageSize(5);

        request.setPagination(pagination);

        SearchFirmwareFileResponse response = Poseidon
                .config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
                .url(serverUrl)
                .getResponse(request, SearchFirmwareFileResponse.class);
    }
}