List Device Current Firmware

罗列某产品下所有设备的固件版本。

操作权限

需授权的资源 所需操作权限
设备管理 Read

请求格式

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

请求参数(URI)

名称 位置(Path/Query) 必需/可选 数据类型 描述
orgId Query 必需 String 资产所属的组织ID。如何获取orgId信息>>
productKey Query 必需 String 产品的Product key。

响应参数

名称 数据类型 描述
data String Array 固件版本号列表。

错误码

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

示例

请求示例

url: https://{apigw-address}/connect-service/v2.1/ota-firmwares?action=listVersion&orgId=yourOrgId&productKey=yourProductKey
method: GET

返回示例

{
    "code": 0,
    "msg": "OK",
    "requestId": "59b92d01-1b8b-44a4-8e6a-01f7d9d256f2",
    "data": [
        "7.7",
        "2.0",
        "7777",
        "AOTA"
    ]
}

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

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

        String orgId = "yourOrgId";
        String productKey = "yourProductKey";

        ListDeviceCurrentFirmwaresRequest request = new ListDeviceCurrentFirmwaresRequest();
        request.setOrgId(orgId);
        request.setProductKey(productKey);

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