Updated on 2026-02-09 GMT+08:00

Creating a Task

Function

This API is used to create a task.

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

    Write

    cpts *

    g:ResourceTag/<tag-key>

    -

    -

URI

POST /v3/{project_id}/tasks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Method of obtaining instructions.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Task name.

parallel

Yes

Boolean

Whether to execute tasks concurrently.

enable_full_link

No

Boolean

Whether full-link pressure test is supported.

project_id

Yes

Integer

Project ID.

operate_mode

Yes

Integer

Task pressure test mode (0: by duration; 1: by count; 2: both). This parameter is compatible with legacy fields in earlier versions, and the fixed value is 2.

case_id_list

Yes

Array of integers

Associated case ID list.

Response Parameters

Status code: 201

Table 3 Response body parameters

Parameter

Type

Description

code

String

Status code.

message

String

Response.

task_id

Integer

Task ID.

Example Requests

Creating a task whose name is task and associated case lists are 449269 and 449270.

/v3/{project_id}/tasks

{
  "name" : "task",
  "parallel" : false,
  "enable_full_link" : true,
  "project_id" : 393862,
  "operate_mode" : 2,
  "case_id_list" : [ 449269, 449270 ]
}

Example Responses

None

Status Codes

Status Code

Description

201

Response object for creating a task.

Error Codes

See Error Codes.