Help Center/ CodeArts PerfTest/ API Reference/ API/ Task Management/ Updating Task Status (Old Version)
Updated on 2025-12-01 GMT+08:00

Updating Task Status (Old Version)

Function

Updating Task Status (Old Version)

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    codeartsperftest:cpts:updatePerfTestTask

    Write

    cpts *

    g:ResourceTag/<tag-key>

    -

    -

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 Method of obtaining instructions.

test_suite_id

Yes

Integer

Test project ID, which is the value of project_id in the response body of the API for creating a project.

task_id

Yes

Integer

Task ID, which is the value of task_id in the response body of the API for creating a task.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

cluster_id

Yes

Integer

Resource group ID.

cluster_type

Yes

String

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

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.

network_info

Yes

NetworkInfo object

Network information.

status

Yes

Integer

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

enterprise_project_id

No

String

Enterprise project ID.

Table 3 NetworkInfo

Parameter

Mandatory

Type

Description

network_type

Yes

String

Network type (fixed value: internet).

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

code

String

Response code.

message

String

Response message.

extend

String

Extension information.

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.

Status code: 501

Table 6 Response body parameters

Parameter

Type

Description

-

String

response message

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.