Retry OTA Task


Retry OTA tasks under the specified OTA job.

Operation Permissions

Required Authorization

Required Operation Permission

Device Management

Full Access

Request Format

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

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

jobId

Query

Mandatory

String

The job ID.

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

deviceKeys

Mandatory

String Array

The list of device keys for retrying the OTA task.

Error Codes

Code

Message

Description

24404

Job not found

The job cannot be found.

24617

Job not running

Not able to retry as it is not running.

24621

Only failed tasks can be retried

Only failed tasks can be retried.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.1/ota-jobs?action=retryTask&orgId=yourOrgId&jobId=yourJobId
method: POST
requestBody: {"deviceKeys":["deviceKey1","deviceKey2"]}

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"8e5d4643-1d13-4dd1-8896-e407f16381df",
    "data":null
}

Java SDK Sample

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.task.RetryTaskRequest;
import com.envisioniot.enos.connect_service.v2_1.ota.job.task.RetryTaskResponse;
import com.google.common.collect.ImmutableSet;

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

        String orgId = "yourOrgId";
        String jobId = "yourobId";

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

        request.setJobId(jobId);
        request.setDeviceKeys(ImmutableSet.of("deviceKey1","deviceKey2"));

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