Help Center/ CodeArts PerfTest/ API Reference/ API/ Task Management/ Creating a Task (Old Edition)
Updated on 2024-04-08 GMT+08:00

Creating a Task (Old Edition)

Function

This API is used to create a task on the old UI.

URI

POST /v1/{project_id}/tasks

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

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Name.

Minimum: 1

Maximum: 42

project_id

Yes

Integer

Project ID.

Minimum: 0

Maximum: 2147483647

temps

No

Array of strings

Transaction information.

Array Length: 0 - 1024

operate_mode

No

Integer

Pressure phase mode (0: by duration; 1: by count; 2: both).

Minimum: 0

Maximum: 2147483647

bench_concurrent

No

Integer

Benchmark concurrency.

Minimum: 0

Maximum: 2147483647

Response Parameters

Status code: 201

Table 3 Response body parameters

Parameter

Type

Description

code

String

Response code.

Minimum: 0

Maximum: 1024

message

String

Response message.

Minimum: 0

Maximum: 1024

task_id

Integer

Task ID.

Minimum: 0

Maximum: 2147483647

Example Requests

Creating a task named task. The ID of the PerfTest project to which the task belongs is 1.

/v1/{project_id}/tasks

{
  "name" : "task",
  "project_id" : 1,
  "temps" : [ ],
  "operate_mode" : 2,
  "bench_concurrent" : 100
}

Example Responses

Status code: 201

success

{
  "code" : "SVCSTG.CPTS.0000000",
  "message" : "success",
  "task_id" : 184138
}

Status Codes

Status Code

Description

201

success

501

unknown error

Error Codes

See Error Codes.