You can call this operation to cancel a running task. You can cancel the running tasks generated by the ImportImage or ExportImage operation.

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 CancelTask

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

RegionId String Yes cn-hangzhou

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

TaskId String Yes t-bp198jigq7l0h5ac****

The ID of the task. You can call the DescribeTasks operation to query the list of task IDs.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CancelTask
&RegionId=cn-hangzhou
&TaskId=t-bp198jigq7l0h5ac****
&<Common request parameters>

Sample success responses

XML format

<CancelTaskResponse>
      <RequestId>4BE2C7FE-C7A4-4675-A153-174E032AABFB</RequestId>
</CancelTaskResponse>

JSON format

{
    "RequestId": "4BE2C7FE-C7A4-4675-A153-174E032AABFB"
}

Error codes

HTTP status code Error code Error message Description
400 MissingParameter An input parameter "RegionId" that is mandatory for processing the request is not supplied. The error message returned because the RegionId parameter is not specified.
400 MissingParameter An input parameter "TaskId" that is mandatory for processing the request is not supplied. The error message returned because the TaskId parameter is not specified.
400 InvalidRegionId.NotFound The specified RegionId does not exist. The error message returned because the specified RegionId parameter does not exist.
400 InvalidTaskId.NotFound The specified "TaskId" is not found. The error message returned because the specified TaskId parameter does not exist.
403 InvalidTaskId.TaskActionNotSupport The specified task action not support. The error message returned because the specified task is not supported.
403 InvalidTaskId.IncorrectTaskStatus The specified task status is invalid. The error message returned because the specified task status is invalid.
403 CancelTaskFailed The task is failed to cancel, Please contact the administrator. The error message returned because the task cannot be canceled. Contact the administrator.

For a list of error codes, visit the API Error Center.