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

Starting or Stopping a Task

Function

This API is used to start or stop a task.

URI

PUT /v2/{project_id}/tasks/{task_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.

task_id

Yes

String

ID of a created task

command

Yes

String

API's action for a task, for example, stopping or starting

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: 400

Table 3 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 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

Example Requests

  • This request is used to stop the task whose ID is {task_id}.

    /v2/{project_id}/tasks/{task_id}/action/{command}
    
    {
      "id" : "String",
      "status_code" : 200,
      "status_msg" : "success"
    }
  • This request is used to start the task whose ID is {task_id}.

    /v2/{project_id}/tasks/{task_id}/action/{command}
    
    {
      "id" : "String",
      "status_code" : 200,
      "status_msg" : "success"
    }

Example Responses

None

Status Codes

Status Code

Description

200

Operation successful

400

Request error

500

Internal error

Error Codes

See Error Codes.