Updated on 2024-04-22 GMT+08:00

Starting or Stopping a Batch Task

Function

This API is used to start or stop a batch task.

URI

PUT /v2/{project_id}/batch-tasks/{id}/action/{command}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

id

Yes

String

Batch task ID

command

Yes

String

API's action for a batch task. The value can be start or stop.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details about how to obtain a user token, see Authentication.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of tasks

failed_count

Integer

Number of failed tasks

succeed_count

Integer

Number of successfully executed tasks

id

String

Batch task ID

error_list

Array of strings

Error information list

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

detail

String

Error details

params

Array of strings

Error parameters

Array Length: 0 - 1

reason

String

Error cause

advice

String

Suggestion

Example Requests

This request is used to start or stop the batch task whose ID is {id}.

 /v2/{project_id}/batch-tasks/{id}/action/{command}

https://{endpoint}/v2/{project_id}/batch-tasks/0d47bbf52962414bb7ae27fb6ea24230/action/{command}?

Example Responses

Status code: 200

Response to a batch operation request

{
  "total_count" : 1,
  "failed_count" : 0,
  "succeed_count" : 1,
  "id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "error_list" : [ ]
}

Status Codes

Status Code

Description

200

Response to a batch operation request

400

Request error

500

Internal error

Error Codes

See Error Codes.