All Products
Search
Document Center

Elastic Compute Service:DescribeTasks

Last Updated:Jan 22, 2025

Queries the progress of one or more asynchronous tasks.

Operation description

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:DescribeTasksget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PageNumberintegerNo

The page number.

Pages start from page 1.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page.

Valid values: 1 to 100.

Default value: 10.

10
RegionIdstringYes

The region ID. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
TaskIdsstringNo

The task IDs. You can specify up to 100 task IDs at a time. Separate the task IDs with commas (,).

t-bp1hvgwromzv32iq****,t-bp179lofu2pv768w****
TaskActionstringNo

The name of the operation that generates the task. Valid values:

  • ImportImage
  • ExportImage
  • RedeployInstance
  • ModifyDiskSpec
ImportImage
TaskStatusstringNo

The task status. Valid values:

  • Finished
  • Processing
  • Failed

This parameter is left empty by default.

Note The system only queries tasks in the Finished, Processing, and Failed states and ignores other values.
Finished
StartTimestringNo

The beginning of the time range to query. The time range refers to the period of time during which the task is created. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

2020-11-23T15:10:00Z
EndTimestringNo

The end of the time range to query. The time range refers to the period of time during which the task is created. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

2020-11-23T15:16:00Z
ResourceIdsarrayNo

The IDs of the resources associated with the task. Valid values of N: 1 to 100.

stringNo

The ID of resource N. Valid values of N: 1 to 100.

  • If you set TaskAction to ImportImage or ExportImage, specify an image ID as a resource ID.
  • If you set TaskAction to RedeployInstance, specify the ID of an Elastic Compute Service (ECS) instance as a resource ID.
  • If you set TaskAction to ModifyDiskSpec, specify a disk ID as a resource ID.
m-bp1i8huqm5u7****

Response parameters

ParameterTypeDescriptionExample
object
PageSizeinteger

The number of entries per page.

10
PageNumberinteger

The page number.

1
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
TotalCountinteger

The total number of entries returned.

1
RegionIdstring

The region ID.

cn-hangzhou
TaskSetarray<object>

Details about the tasks.

Taskobject
CreationTimestring

The time when the task was created.

2020-11-24T12:50Z
TaskStatusstring

The task status.

Finished
FinishedTimestring

The time when the task ended.

2020-11-24T12:50Z
SupportCancelstring

Indicates whether the task can be canceled.

true
TaskIdstring

The task ID.

t-bp1hvgwromzv32iq****
TaskActionstring

The name of the operation that generates the task.

ImportImage
ResourceIdstring

The resource ID.

m-bp1i8huqm5u7****

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "PageNumber": 1,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "TotalCount": 1,
  "RegionId": "cn-hangzhou",
  "TaskSet": {
    "Task": [
      {
        "CreationTime": "2020-11-24T12:50Z",
        "TaskStatus": "Finished",
        "FinishedTime": "2020-11-24T12:50Z",
        "SupportCancel": "true",
        "TaskId": "t-bp1hvgwromzv32iq****",
        "TaskAction": "ImportImage",
        "ResourceId": "m-bp1i8huqm5u7****"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameterAn input parameter "RegionId" that is mandatory for processing the request is not supplied.-
400InvalidRegionId.NotFoundThe specified RegionId does not exist.The specified region ID does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history