All Products
Search
Document Center

IoT Platform:ListTask

Last Updated:Jan 15, 2024

Queries the sub-tasks of a task or a device.

QPS limits

You can call this API operation up to five times per second per account.

Note The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTask

The operation that you want to perform. Set the value to ListTask.

Limit Integer Yes 10

The number of entries per page. Default value: 10. Maximum value: 50.

IotInstanceId String No iot-cn-0pp1n8t****

The ID of the instance. You can view the ID of the instance on the Overview tab in the IoT Platform console.

Important
  • If your instance has an ID, you must specify this parameter. Otherwise, the call fails.
  • If no Overview tab or ID is generated for your instance, you do not need to specify this parameter.

For more information about instances, see Overview.

JobId String No sGWotgRk***010001

The ID of the task. The ID is globally unique.

Note If you specify Device, do not specify this parameter.
NextToken String No 22dhgg***

The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.

The value of NextToken is valid for 1 minute. If a token expires, an error code is returned.

Device Json No {}

The details of the device. For more information, see the "Device definition" section of this topic.

Note If you specify JobId, do not specify this parameter.
Status String No QUEUED

The status of the sub-task. Default value: 1. Valid values:

  • QUEUED: The sub-task is waiting for scheduling.
  • SENT: The sub-task is scheduled.
  • IN_PROGRESS: The sub-task is in progress.
  • FAILED: The sub-task failed.
  • REJECTED: The sub-task is rejected.
  • TIMED_OUT: The sub-task timed out.
  • SUCCEEDED: The sub-task was successful.
  • CANCELLED: The sub-task is canceled.
Device definition

Parameter

Type

Description

IotId

String

The ID of the device. IotId, ProductKey, and DeviceName cannot be left empty at the same time.

ProductKey

String

The ProductKey of the product to which the device belongs.

If you specify this parameter, you must specify DeviceName.

DeviceName

String

The DeviceName of the device.

If you specify this parameter, you must specify ProductKey.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

The error code returned if the call fails. For more information, see Error codes.

Data Array of data

The sub-task details returned if the call is successful. For more information, see the following parameters.

data
DeviceName String mydevice

The DeviceName of the device.

IotId String BDjhIC***i000101

The ID of the device. The ID is a unique identifier that is issued by IoT Platform to the device.

JobId String sGWotg***010001

The ID of the task. The ID is globally unique.

JobName String MyTestJobIax6Eq

The name of the task.

ProductKey String a1S0OM***

The ProductKey of the product to which the device belongs.

Progress String 80

The progress of the sub-task.

Status String SUCCEEDED

The status of the sub-task.

  • QUEUED: The sub-task is waiting for scheduling.
  • SENT: The sub-task is scheduled.
  • IN_PROGRESS: The sub-task is in progress.
  • FAILED: The sub-task failed.
  • REJECTED: The sub-task is rejected.
  • TIMED_OUT: The sub-task timed out.
  • SUCCEEDED: The sub-task was successful.
  • CANCELLED: The sub-task is canceled.
TaskId String MSnT9wl***q010101

The ID of the sub-task. The ID globally identifies the sub-task.

UtcModified String 2019-05-21T13:03:56.000Z

The time when the sub-task was last modified.

UtcQueueTime String 2019-05-21T13:03:53.000Z

The period for which the sub-task was queued.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

NextToken String 223sdf***

A pagination token. It can be used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextPageToken.

The value of NextToken is valid for 1 minute. If a token expires, an error code is returned.

RequestId String 512FF8FD-A97F-4AAF-B0A2-7BE3D3A19BB3

The ID of the request.

Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=ListTask
&Limit=10
&JobId=XUbmsMHmkqv0PiAG****010001
&<Common request parameters>

Sample success responses

XML format

<ListTaskResponse>
  <NextToken>223sdf***</NextToken>
  <RequestId>512FF8FD-A97F-4AAF-B0A2-7BE3D3A19BB3</RequestId>
  <Data>
        <data>
              <Status>SUCCEEDED</Status>
              <IotId>BDjhIC***i000101</IotId>
              <Progress>80</Progress>
              <TaskId>MSnT9wl***q010101</TaskId>
              <JobName>MyTestJobIax6Eq</JobName>
              <UtcModified>2019-05-21T13:03:56.000Z</UtcModified>
              <UtcQueueTime>2019-05-21T13:03:53.000Z</UtcQueueTime>
              <ProductKey>a1S0OM***</ProductKey>
              <JobId>sGWotg***010001</JobId>
              <DeviceName>mydevice</DeviceName>
        </data>
  </Data>
  <Success>true</Success>
</ListTaskResponse>

JSON format

{
    "NextToken": "223sdf***",
    "RequestId": "512FF8FD-A97F-4AAF-B0A2-7BE3D3A19BB3",
    "Data": {
        "data": {
            "Status": "SUCCEEDED",
            "IotId": "BDjhIC***i000101",
            "Progress": 80,
            "TaskId": "MSnT9wl***q010101",
            "JobName": "MyTestJobIax6Eq",
            "UtcModified": "2019-05-21T13:03:56.000Z",
            "UtcQueueTime": "2019-05-21T13:03:53.000Z",
            "ProductKey": "a1S0OM***",
            "JobId": "sGWotg***010001",
            "DeviceName": "mydevice"
        }
    },
    "Success": true
}

Error codes

For a list of error codes, see Service error codes.