Search Firmware File


按条件查询一个 OU 下的固件信息。

操作权限

需授权的资源

所需操作权限

设备管理

Read

请求格式

POST https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=search

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

资产所属的组织 ID。 如何获取 orgId 信息>>

请求参数(Body)

名称

必需/可选

数据类型

描述

expression

可选

String

查询表达式,支持类 SQL 的查询。目前支持查询的字段是 productKeyisVerified

  • productKey 支持等于(=)、in 运算符。

  • isVerified 不支持模糊匹配,支持等于(=)运算符。

pagination

可选

Pagination 请求结构体

分页参数。如未指定,默认每页10条。每页最大记录数为200条,但为获得最佳性能,建议每页不超过50条。不支持使用 sorters 参数对结果进行排序,查询结果按照 createTime,最近创建的靠前排列。详见 Pagination 请求结构体>>

响应参数

名称

数据类型

描述

data

FirmwareInfo 结构体数组

固件的详情,FirmwareInfo 结构体的结构参见 FirmwareInfo 结构体>>

错误码

有关错误码的描述,参见 通用错误码

示例

请求示例

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
    }
}

返回示例

{
    "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 调用示例

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);
    }
}