Start OTA Job

启动一个OTA job。

操作权限

需授权的资源

所需操作权限

设备管理

Full Access

请求格式

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

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

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

jobId

Query

必需

String

需要启动的OTA job的ID。

错误码

代码

错误信息

描述

24404

Job not found

找不到OTA job。

24615

Job has started

OTA job已启动。

示例

请求示例

url: https://{apigw-address}/connect-service/v2.1/ota-jobs?action=start&orgId=yourOrgId&jobId=yourJobId
method: POST

返回示例

{
    "code":0,
    "msg":"OK",
    "requestId":"3bdf31b4-e357-4d4c-8cf9-a40dc129a407",
    "data":null
}

Java SDK调用示例

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.connect_service.v2_1.ota.job.StartJobRequest;
import com.envisioniot.enos.connect_service.v2_1.ota.job.StartJobResponse;

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

        String orgId = "yourOrgId";
        String jobId = "yourJobId";

        StartJobRequest request = new StartJobRequest();
        request.setOrgId(orgId);
        request.setJobId(jobId);

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