Updated on 2024-03-27 GMT+08:00

Batch Stopping Tasks

Function

This API is used to batch stop tasks with a specified ID.

URI

POST /v5/{project_id}/jobs/batch-stop

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

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.

The default value is application/json.

X-Auth-Token

Yes

String

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.

After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of objects

Request body for stopping tasks in batches.

For details, see Table 4.

Table 4 Data structure description of field jobs

Parameter

Mandatory

Type

Description

job_id

Yes

String

Task ID.

is_force_stop

No

Boolean

Set this parameter to true when a task is forcibly stopped. The default value is false.

Default value: false

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

jobs

Array of objects

Response body for performing operations on tasks in batches.

For details, see Table 6.

Table 6 Data structure description of field jobs

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 12

Maximum length: 12

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

id

String

Task ID.

name

String

Task name.

status

String

Operation result.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 12

Maximum length: 12

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

Example Request

Batch stopping tasks with a specified ID

https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-stop

{
  "jobs": [
    {
      "job_id": "c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r"
    },
    {
      "job_id": "dc6016cf-f3b6-4c2d-b4d7-5084b0fjb20s",
      "is_force_stop": false
    },
    {
      "job_id": "dc6016cf-f3b6-4c2d-b4d7-5084b0fjb20t",
      "is_force_stop": true
    }
  ]
}

Example Response

Status code: 200

OK

{
  "jobs" : [ {
    "id" : "c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r",
    "name" : "DRS-1234",
    "status" : "Success"
  }, {
    "id" : "dc6016cf-f3b6-4c2d-b4d7-5084b0fjb20r",
    "name" : "DRS-2345",
    "status" : "Failed",
    "error_code" : "DRS.10020102",
    "error_msg" : "Job does not exist, please check job ID"
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "DRS.10000001",
  "error_msg" : "Failed."
}

Status Code

Status Code

Description

200

OK

400

Bad Request

Error Code

For details, see Error Code.