Help Center> CodeArts PerfTest> API Reference> API> Task Management> Updating the Status of a Task
Updated on 2024-04-08 GMT+08:00

Updating the Status of a Task

Function

This API is used to update the status of a task.

URI

POST /v1/{project_id}/test-suites/{test_suite_id}/tasks/{task_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Minimum: 0

Maximum: 64

test_suite_id

Yes

Integer

Test project ID.

Minimum: 0

Maximum: 2147483647

task_id

Yes

Integer

Task ID.

Minimum: 0

Maximum: 2147483647

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

cluster_id

Yes

Integer

Resource group ID.

Minimum: -1

Maximum: 2147483647

cluster_type

Yes

String

Resource group type (shared-cluster-internet: shared resource group; private-cluster: private resource group).

Minimum: 0

Maximum: 1024

without_package

Yes

Integer

Whether to use the pay-per-use billing mode when the VUM of the package is insufficient. The value is fixed at 0 in the current edition.

Minimum: 0

Maximum: 2147483647

network_info

Yes

NetworkInfo object

Network information.

status

Yes

Integer

Status (9: task started; 2: task stopped).

Minimum: 0

Maximum: 2147483647

enterprise_project_id

No

String

Enterprise project ID.

Minimum: 0

Maximum: 64

Table 3 NetworkInfo

Parameter

Mandatory

Type

Description

network_type

Yes

String

Network type (fixed value: internet).

Minimum: 0

Maximum: 1024

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

code

String

Response code.

Minimum: 0

Maximum: 1024

message

String

Response message.

Minimum: 0

Maximum: 1024

extend

String

Extension information.

Minimum: 0

Maximum: 1024

result

UpdateTaskStatusResult object

Status update result.

Table 5 UpdateTaskStatusResult

Parameter

Type

Description

task_run_id

Integer

ID of a running task, that is, the report ID.

Minimum: 0

Maximum: 2147483647

Example Requests

  • Starting a task whose ID is 1. The ID of the project to which the task belongs is 1. Use the shared resource group to start the task.

    /v1/{project_id}/test-suites/1/tasks/1
    
    {
      "cluster_id" : 0,
      "enterprise_project_id" : "0",
      "cluster_type" : "shared-cluster-internet",
      "without_package" : 0,
      "network_info" : {
        "network_type" : "internet"
      },
      "status" : 9
    }
  • Starting a task whose ID is 1. The ID of the project to which the task belongs is 1.

    /v1/{project_id}/test-suites/1/tasks/1
    
    {
      "cluster_id" : -1,
      "enterprise_project_id" : "0",
      "cluster_type" : "shared-cluster-internet",
      "network_info" : {
        "network_type" : "internet"
      },
      "status" : 2,
      "without_package" : 0
    }

Example Responses

Status code: 200

success

{
  "code" : "SVCSTG.CPTS.0000000",
  "message" : "success",
  "extend" : null,
  "result" : {
    "task_run_id" : 32517
  }
}

Status Codes

Status Code

Description

200

success

501

unknown error

Error Codes

See Error Codes.