Get OTA Job


Get the details of an OTA job.

Operation Permissions

Required Authorization

Required Operation Permission

Device Management

Read

Request Format

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

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 OTA job ID.

Response Parameters

Name

Data Type

Description

data

JobInfo Struct

The details of the OTA job. For more information, see JobInfo Struct>>

JobInfo Struct

Name

Data Type

Description

orgId

String

The organization ID.

productKey

String

The product key.

jobId

String

The OTA job ID.

name

StringI18n

The job name.

firmwareId

String

The firmware ID.

type

String

The job type, verify or upgrade.

enableUpgradeRequest

Boolean

  • true: Device can request for upgrade.

  • false: Device cannot request for upgrade.

upgradePolicy

String

The upgrade policy, snapshot or incremental.

upgradeScope

UpgradeScope Struct

The scope of the upgrade. For more details, see UpgradeScope Struct>>

upgradeTimeout

Long

The timeout in seconds for the upgrade/verification, which starts when the OTA task enters the “upgrading” state. You can use the Search OTA Task API to search for the status of the OTA task.

retryPolicy

RetryPolicy Struct

The policy for retrying failed OTA tasks. For more details, see RetryPolicy Struct>>

schedulePolicy

SchedulePolicy Struct

The schedule policy for the OTA task. For more details, see SchedulePolicy Struct>>

maximumConcurrency

Integer

The maximum number of concurrent upgrade tasks.

status

String

The status of the job, started or stopped.

createTime

Long

The time when the OTA job was created.

Error Codes

Code

Message

Description

24404

Job not found

The job cannot be found.

Samples

Request Sample

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

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"42fc4dcd-636b-48ac-a69b-4d2f95d0c3de",
    "data":{
        "orgId":"o15475466766371",
        "productKey":"BXwU4kMk",
        "jobId":"5ed758ca49f032b4663063aa",
        "name":{
            "defaultValue":"name",
            "i18nValue":{

            }
        },
        "firmwareId":"5ed0dd4a646542001b3d113f",
        "type":"upgrade",
        "enableUpgradeRequest":true,
        "upgradePolicy":null,
        "upgradeScope":{
            "type":"total",
            "versionNumbers":[
                "1.0"
            ],
            "deviceKeys":null,
            "attributes":null,
            "tags":null,
            "assetTrees":null
        },
        "startSchedule":0,
        "endSchedule":86399,
        "status":"started",
        "createTime":1591171274788,
        "startAfterCreate":true
    }
}

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

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

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

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

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