Stopping or Deleting Tasks in Batches
Function
This API is used to stop tasks in batches or delete real-time migration, real-time synchronization, and real-time DR tasks.
After a yearly/monthly task is started, unsubscribe from the order and then call this API to delete the task. For details, see Unsubscribing from a Yearly/Monthly Task.
Debugging
You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.
Constraints
- Only tasks in the CREATE_FAILED, RELEASE_RESOURCE_COMPLETE, or RELEASE_CHILD_TRANSFER_COMPLETE state can be deleted. To delete a task in other states, stop the task first.
- The parent task can call the API only in the dual-active DR scenario.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions and Supported Actions.
URI
DELETE /v3/{project_id}/jobs/batch-jobs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | Yes | String | Definition MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type. Constraints N/A Range application/json Default Value application/json |
| X-Auth-Token | Yes | String | Definition User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The token is the value of X-Subject-Token in the response header. Constraints N/A Range N/A Default Value N/A |
| X-Language | No | String | Definition Request language type. Constraints N/A Range
Default Value en-us |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| jobs | Yes | Array of objects | Definition Request list for stopping or deleting tasks in batches, which specifies the tasks to be stopped or deleted. For details, see Table 4. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| delete_type | Yes | String | Definition Operation type for stopping or deleting tasks in batches. This parameter specifies whether to stop or delete a task. Constraints To delete a yearly/monthly task, you need to manually unsubscribe from it first, and then call this API and set delete_type to delete. Range
Default Value N/A |
| job_id | Yes | String | Definition Task ID, which uniquely identifies a data replication task to be stopped or deleted. Constraints N/A Range N/A Default Value N/A |
| is_show_breakpoint_position | No | Boolean | Definition Whether to display breakpoint information upon completion for data replication tasks with MySQL as the source. Constraints This parameter is available only for real-time migration, synchronization, and DR tasks with MySQL as the source. Range Default Value N/A |
Response Parameters
Status code: 202
| Parameter | Type | Description |
|---|---|---|
| results | Array of objects | Definition Response body set for stopping or deleting tasks in batches, which includes the operation result of each task. For details, see Table 6. |
| count | Integer | Definition Total number of results for stopping or deleting tasks in batches, which is the same as the length of the results array. Constraints N/A Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition ID of the task for which the stop or deletion operation is performed. It is used to identify the task corresponding to the operation result. Constraints N/A Range N/A |
| status | String | Definition Execution result of the task, which indicates whether the task is successful. Constraints N/A Range
|
| error_code | String | Definition Error code returned if the operation fails. Constraints N/A Range The value is in the format of DRS.XXXXXX. |
| error_msg | String | Definition Error message returned if the operation fails. Constraints N/A Range N/A |
Example Request
- Stopping two specified tasks
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [ { "delete_type" : "terminate", "job_id" : "4c6ac8c0-2f51-426a-97b2-cb2c668jb201" }, { "delete_type" : "terminate", "job_id" : "6211d20d-0006-41da-836e-db3301ajb20b" } ] } - Deleting a specified task
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [ { "delete_type" : "delete", "job_id" : "140b5236-88ad-43c8-811c-1268453jb101" } ] }
- Displaying breakpoint information when a task is complete
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-jobs { "jobs" : [{ "delete_type" : "terminate", "job_id" : "6211d20d-0006-41da-836e-db3301ajb20b", "is_show_breakpoint_position" : true } ] }
Example Response
Status code: 202
Accepted
- Example response for stopping a task
{ "count" : 2, "results" : [ { "id" : "4c6ac8c0-2f51-426a-97b2-cb2c668jb201", "status" : "success" }, { "id" : "6211d20d-0006-41da-836e-db3301ajb20b", "status" : "failed", "error_code" : "DRS.M01504", "error_msg" : "Another operation is being performed on the migration task or the migration task is abnormal. Try again later." } ] } - Example response for deleting a task
{ "count" : 1, "results" : [ { "id" : "140b5236-88ad-43c8-811c-1268453jb101", "status" : "success" } ] }
Status Code
| Status Code | Description |
|---|---|
| 202 | Accepted |
| 400 | Bad Request |
For other statuses, see Status Code.
Error Code
For details, see Error Code.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot