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

Modifying a Task (Old Edition)

Function

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

URI

PUT /v1/{project_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.

task_id

Yes

Integer

Task ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

id

Yes

Integer

Task ID.

name

Yes

String

Task name.

description

No

String

Description.

project_id

Yes

Integer

Project ID.

run_status

No

Integer

Task running status (9: waiting to run; 0: running; 1: paused; 2: ended; 3: stopped abnormally; 4: stopped by the user (completed); 5: stopped by the user).

run_type

No

Integer

Task type (0: old edition task; 1: new edition task).

task_run_info

No

TaskRunInfo object

Task running information.

case_list

No

Array of CaseInfoDetail objects

Case information.

operate_mode

No

Integer

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

bench_concurrent

No

Integer

Benchmark concurrency.

related_temp_running_data

No

Array of RelatedTempRunningData objects

Brief information about the latest running report.

Table 3 TaskRunInfo

Parameter

Mandatory

Type

Description

id

No

Integer

Task ID.

run_type

No

Integer

Task type (0: old edition task; 1: new edition task).

Table 4 CaseInfoDetail

Parameter

Mandatory

Type

Description

case_id

No

Integer

Case ID.

name

No

String

Case name.

case_type

No

Integer

Case type (0: normal case).

contents

No

Array of Contents objects

Case script information.

for_loop_params

No

Array of objects

Logic controller field of the old edition. This parameter is not used in the current edition.

increase_setting

No

Array of objects

Gradient increment.

stages

No

Array of TestCaseStage objects

Phase information.

status

No

Integer

Status (0: deleted; 1: enabled; 2: disabled).

temp_id

No

Integer

Case ID.

sort

No

Integer

Sorting field.

directory_id

No

Integer

Directory ID of the case. This parameter is optional for APIs of earlier versions.

setup_contents

No

Array of Contents objects

Preparations.

user_replicas

No

Integer

Actuators.

collect_log_policy

No

Integer

Log collection policy (0: request mode; 1: case mode).

link_app_list

No

Array of integers

Associated full-link application list.

case_info

No

CaseDoc object

Text case information.

Table 5 TestCaseStage

Parameter

Mandatory

Type

Description

operate_mode

No

Integer

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

name

No

String

Phase name.

time

No

Integer

Duration, in seconds.

start_time

No

Integer

Start time.

end_time

No

Integer

End time.

issue_num

No

Integer

Maximum concurrency.

count

No

Integer

Total transmission times.

pressure_mode

No

Integer

Pressure mode (0: concurrent mode; 1: TPS mode; 2: high pressure mode; 3: surge concurrency mode; 4: surge TPS mode; 5: flapping concurrency mode; 6: flapping TPS mode; 7: intelligent high pressure mode).

tps_value

No

Integer

TPS value in TPS mode.

current_user_num

No

Integer

Start concurrency.

current_tps

No

Integer

Start TPS value.

voltage_regulating_mode

No

Integer

Pressure adjustment mode (0: automated; 1: manual).

maximum

No

Integer

Maximum concurrency in the surge mode.

minimum

No

Integer

Minimum concurrency in the surge mode.

loop_count

No

Integer

Oscillation/surge times.

max_duration

No

Integer

Peak duration in the surge mode.

ramp_up

No

Integer

Ramp up (in seconds) in the peakload mode.

peak_load_kpis

No

StageKpiItems object

Expected KPI.

step_duration

No

Integer

Single-step execution duration in the intelligent peakload mode.

step_size

No

Integer

Increase concurrency in the intelligent peakload mode.

Table 6 StageKpiItems

Parameter

Mandatory

Type

Description

average_response_time

No

StageKpiItem object

Average response time.

success_rate

No

StageKpiItem object

Success rate.

Table 7 StageKpiItem

Parameter

Mandatory

Type

Description

comparison

No

String

Comparison operator.

value

No

Integer

Comparison value.

Table 8 Contents

Parameter

Mandatory

Type

Description

content_id

No

Integer

Transaction ID. If the transaction ID is not 0, the card is a transaction. If it is 0, the card is not a transaction.

content

No

Array of Content objects

Content.

index

No

Integer

Sorting index.

selected_temp_name

No

String

Name of the selected transaction or case.

data

No

Object

Data to which the loop and condition controller apply.

data_type

No

Integer

Type (0: default request; 1: data instruction; 201: cycle instruction; 202: condition instruction; 301: rendezvous point).

conditions

No

Object

If the type is 202 (condition instruction), this field configures the condition.

is_disabled

No

Boolean

Whether to disable the AW.

Table 9 Content

Parameter

Mandatory

Type

Description

content_type

No

Integer

Case card type (1: think time; 2: packet; 3: checkpoint; 4: variable extraction).

content

No

ContentInfo object

Content.

Table 10 ContentInfo

Parameter

Mandatory

Type

Description

body_type

No

Integer

Body type (0: string; 1: form-data format; 3: x-www-form-urlencoded format).

bodys

No

Array of objects

Request body.

check_end_length

No

Object

Length of the data returned through TCP/UDP.

check_end_str

No

Object

End character returned through TCP/UDP.

check_end_type

No

Object

End type (1: data length; 2: end character) returned through TCP/UDP.

connect_timeout

No

Integer

Timeout duration.

connect_type

No

Integer

Connection settings. This parameter is not used in the current edition.

headers

No

Array of ContentHeader objects

Request header.

http_version

No

String

HTTP version.

method

No

String

HTTP method.

name

No

String

Case name.

protocol_type

No

Integer

Protocol type (1: HTTP; 2: HTTPS; 3: TCP; 4: UDP; 7: HLS/RTMP; 9: WebSocket; 10: HTTP-FLV).

return_timeout

No

Integer

Response timeout.

return_timeout_param

No

String

Response timeout parameter.

url

No

String

Request URL.

rtmp_url

No

String

RTMP address.

flv_url

No

String

FLV address.

bitrate_type

No

Integer

Resolution policy.

duration

No

Integer

Duration.

retry_delay

No

Integer

HLS retry delay.

retry_time

No

Integer

HLS retries.

Table 11 ContentHeader

Parameter

Mandatory

Type

Description

key

No

String

Key.

value

No

String

Value.

Table 12 CaseDoc

Parameter

Mandatory

Type

Description

description

No

String

Case description.

label_names

No

Array of strings

Tags.

preparation

No

String

Preparations.

rank

No

Integer

Case level (0: L0, 1: L1, 2: L2, 3: L3, 4: L4).

status_code

No

Integer

Status (0: new; 5: designing; 6: testing; 7: completed).

steps

No

Array of steps objects

Procedure.

Table 13 steps

Parameter

Mandatory

Type

Description

expect_result

No

String

Step description.

test_step

No

String

Expected result.

Table 14 RelatedTempRunningData

Parameter

Mandatory

Type

Description

task_run_info_id

No

Integer

ID of a running task, that is, the report ID. When a task API (for updating task status or starting or stopping tasks in batches) is called, the running task ID is returned.

related_temp_running_id

No

Integer

ID of a running case. The value is same as that of the running case ID (case_run_id) of other APIs (such as a report API).

temp_id

No

Integer

Case ID.

temp_name

No

String

Case name.

content_method_url

No

Array of strings

Request information, including the request name, method, and URL.

related_temp_running_data

No

Array of TempRunningData objects

Brief information about the latest running report.

Table 15 TempRunningData

Parameter

Mandatory

Type

Description

content_method_url

No

Array of strings

Request information, including the request name, method, and URL.

crawler_status

No

Integer

Request running status (0: normal response; 1: parsing failed; 2: comparison failed; 3: response timed out).

related_temp_running_id

No

Integer

ID of a running case. The value is same as that of the running case ID (case_run_id) of other APIs (such as a report API).

task_run_info_id

No

Integer

ID of a running task, that is, the report ID. When a task API (for updating task status or starting or stopping tasks in batches) is called, the running task ID is returned.

temp_id

No

Integer

Case or transaction ID.

temp_name

No

String

Case or transaction name.

temp_running_status

No

Integer

Running status (9: waiting to run; 0: running; 2: ended; 3: stopped abnormally; 4: stopped by the user (completely stopped); 5: stopped by the user (stopping)).

Response Parameters

Status code: 200

Table 16 Response body parameters

Parameter

Type

Description

code

String

Response code.

message

String

Response message.

taskInfo

TaskInfo object

Task details.

Table 17 TaskInfo

Parameter

Type

Description

bench_concurrent

Integer

Benchmark concurrency.

case_list

Array of CaseInfoDetail objects

Case ID list.

create_time

String

Creation time.

description

String

Description.

name

String

Task name.

operate_mode

Integer

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

project_id

Integer

ID of the project to which the task belongs.

related_temp_running_data

Array of RelatedTempRunningData objects

Brief information about the latest running report, including the running task ID, that is, the task_run_info_id of the object. ID of a running case, that is, related_temp_running_id of the object.

run_status

Integer

Task running status (9: waiting to run; 0: running; 1: paused; 2: ended; 3: stopped abnormally; 4: stopped by the user (completed); 5: stopped by the user).

update_time

String

Time when a task is updated.

parallel

Boolean

Whether cases are executed in parallel between tasks.

Table 18 CaseInfoDetail

Parameter

Type

Description

case_id

Integer

Case ID.

name

String

Case name.

case_type

Integer

Case type (0: normal case).

contents

Array of Contents objects

Case script information.

for_loop_params

Array of objects

Logic controller field of the old edition. This parameter is not used in the current edition.

increase_setting

Array of objects

Gradient increment.

stages

Array of TestCaseStage objects

Phase information.

status

Integer

Status (0: deleted; 1: enabled; 2: disabled).

temp_id

Integer

Case ID.

sort

Integer

Sorting field.

directory_id

Integer

Directory ID of the case. This parameter is optional for APIs of earlier versions.

setup_contents

Array of Contents objects

Preparations.

user_replicas

Integer

Actuators.

collect_log_policy

Integer

Log collection policy (0: request mode; 1: case mode).

link_app_list

Array of integers

Associated full-link application list.

case_info

CaseDoc object

Text case information.

Table 19 TestCaseStage

Parameter

Type

Description

operate_mode

Integer

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

name

String

Phase name.

time

Integer

Duration, in seconds.

start_time

Integer

Start time.

end_time

Integer

End time.

issue_num

Integer

Maximum concurrency.

count

Integer

Total transmission times.

pressure_mode

Integer

Pressure mode (0: concurrent mode; 1: TPS mode; 2: high pressure mode; 3: surge concurrency mode; 4: surge TPS mode; 5: flapping concurrency mode; 6: flapping TPS mode; 7: intelligent high pressure mode).

tps_value

Integer

TPS value in TPS mode.

current_user_num

Integer

Start concurrency.

current_tps

Integer

Start TPS value.

voltage_regulating_mode

Integer

Pressure adjustment mode (0: automated; 1: manual).

maximum

Integer

Maximum concurrency in the surge mode.

minimum

Integer

Minimum concurrency in the surge mode.

loop_count

Integer

Oscillation/surge times.

max_duration

Integer

Peak duration in the surge mode.

ramp_up

Integer

Ramp up (in seconds) in the peakload mode.

peak_load_kpis

StageKpiItems object

Expected KPI.

step_duration

Integer

Single-step execution duration in the intelligent peakload mode.

step_size

Integer

Increase concurrency in the intelligent peakload mode.

Table 20 StageKpiItems

Parameter

Type

Description

average_response_time

StageKpiItem object

Average response time.

success_rate

StageKpiItem object

Success rate.

Table 21 StageKpiItem

Parameter

Type

Description

comparison

String

Comparison operator.

value

Integer

Comparison value.

Table 22 Contents

Parameter

Type

Description

content_id

Integer

Transaction ID. If the transaction ID is not 0, the card is a transaction. If it is 0, the card is not a transaction.

content

Array of Content objects

Content.

index

Integer

Sorting index.

selected_temp_name

String

Name of the selected transaction or case.

data

Object

Data to which the loop and condition controller apply.

data_type

Integer

Type (0: default request; 1: data instruction; 201: cycle instruction; 202: condition instruction; 301: rendezvous point).

conditions

Object

If the type is 202 (condition instruction), this field configures the condition.

is_disabled

Boolean

Whether to disable the AW.

Table 23 Content

Parameter

Type

Description

content_type

Integer

Case card type (1: think time; 2: packet; 3: checkpoint; 4: variable extraction).

content

ContentInfo object

Content.

Table 24 ContentInfo

Parameter

Type

Description

body_type

Integer

Body type (0: string; 1: form-data format; 3: x-www-form-urlencoded format).

bodys

Array of objects

Request body.

check_end_length

Object

Length of the data returned through TCP/UDP.

check_end_str

Object

End character returned through TCP/UDP.

check_end_type

Object

End type (1: data length; 2: end character) returned through TCP/UDP.

connect_timeout

Integer

Timeout duration.

connect_type

Integer

Connection settings. This parameter is not used in the current edition.

headers

Array of ContentHeader objects

Request header.

http_version

String

HTTP version.

method

String

HTTP method.

name

String

Case name.

protocol_type

Integer

Protocol type (1: HTTP; 2: HTTPS; 3: TCP; 4: UDP; 7: HLS/RTMP; 9: WebSocket; 10: HTTP-FLV).

return_timeout

Integer

Response timeout.

return_timeout_param

String

Response timeout parameter.

url

String

Request URL.

rtmp_url

String

RTMP address.

flv_url

String

FLV address.

bitrate_type

Integer

Resolution policy.

duration

Integer

Duration.

retry_delay

Integer

HLS retry delay.

retry_time

Integer

HLS retries.

Table 25 ContentHeader

Parameter

Type

Description

key

String

Key.

value

String

Value.

Table 26 CaseDoc

Parameter

Type

Description

description

String

Case description.

label_names

Array of strings

Tags.

preparation

String

Preparations.

rank

Integer

Case level (0: L0, 1: L1, 2: L2, 3: L3, 4: L4).

status_code

Integer

Status (0: new; 5: designing; 6: testing; 7: completed).

steps

Array of steps objects

Procedure.

Table 27 steps

Parameter

Type

Description

expect_result

String

Step description.

test_step

String

Expected result.

Table 28 RelatedTempRunningData

Parameter

Type

Description

task_run_info_id

Integer

ID of a running task, that is, the report ID. When a task API (for updating task status or starting or stopping tasks in batches) is called, the running task ID is returned.

related_temp_running_id

Integer

ID of a running case. The value is same as that of the running case ID (case_run_id) of other APIs (such as a report API).

temp_id

Integer

Case ID.

temp_name

String

Case name.

content_method_url

Array of strings

Request information, including the request name, method, and URL.

related_temp_running_data

Array of TempRunningData objects

Brief information about the latest running report.

Table 29 TempRunningData

Parameter

Type

Description

content_method_url

Array of strings

Request information, including the request name, method, and URL.

crawler_status

Integer

Request running status (0: normal response; 1: parsing failed; 2: comparison failed; 3: response timed out).

related_temp_running_id

Integer

ID of a running case. The value is same as that of the running case ID (case_run_id) of other APIs (such as a report API).

task_run_info_id

Integer

ID of a running task, that is, the report ID. When a task API (for updating task status or starting or stopping tasks in batches) is called, the running task ID is returned.

temp_id

Integer

Case or transaction ID.

temp_name

String

Case or transaction name.

temp_running_status

Integer

Running status (9: waiting to run; 0: running; 2: ended; 3: stopped abnormally; 4: stopped by the user (completely stopped); 5: stopped by the user (stopping)).

Status code: 501

Table 30 Response body parameters

Parameter

Type

Description

-

String

response message

Example Requests

Changing the name of the task whose ID is 1 to taskName.

/v1/{project_id}/tasks/1

{
  "id" : 1,
  "name" : "taskName",
  "description" : "",
  "project_id" : 1,
  "run_status" : 2,
  "run_type" : 0,
  "task_run_info" : {
    "id" : 0,
    "run_type" : 0
  },
  "case_list" : [ ],
  "operate_mode" : 2,
  "bench_concurrent" : 100,
  "related_temp_running_data" : [ {
    "task_run_info_id" : 325,
    "related_temp_running_id" : 350,
    "temp_id" : 0,
    "temp_name" : "asdf"
  } ]
}

Example Responses

Status code: 200

success

{
  "code" : "SVCSTG.CPTS.0000000",
  "message" : "success",
  "taskInfo" : {
    "bench_concurrent" : 100,
    "case_list" : [ {
      "case_id" : 211751,
      "case_type" : 0,
      "contents" : [ {
        "content_id" : 0,
        "content" : [ {
          "content_type" : 2,
          "content" : {
            "body_type" : 0,
            "bodys" : [ ],
            "check_end_length" : null,
            "check_end_str" : null,
            "check_end_type" : null,
            "connect_timeout" : 5000,
            "connect_type" : 1,
            "headers" : [ {
              "key" : "Content-Type",
              "value" : "application/json"
            } ],
            "http_version" : "HTTP/1.1",
            "method" : "GET",
            "name" : "Msg-43147",
            "protocol_type" : 1,
            "return_timeout" : 5000,
            "return_timeout_param" : null,
            "url" : "https://www.example.com"
          }
        } ],
        "index" : 0,
        "selected_temp_name" : "",
        "data" : null,
        "data_type" : 0,
        "conditions" : null
      } ],
      "for_loop_params" : [ ],
      "increase_setting" : [ ],
      "sort" : 1,
      "stages" : [ ],
      "status" : 1,
      "temp_id" : 0,
      "user_replicas" : 0
    }, {
      "case_id" : 213142,
      "case_type" : 0,
      "contents" : null,
      "for_loop_params" : [ ],
      "increase_setting" : [ ],
      "sort" : 2,
      "stages" : [ ],
      "status" : 1,
      "temp_id" : 0,
      "user_replicas" : 0
    } ],
    "create_time" : "2022-01-18T15:20:50.466972+08:00",
    "description" : "",
    "name" : "task",
    "operate_mode" : 2,
    "parallel" : false,
    "project_id" : 122025,
    "related_temp_running_data" : [ ],
    "run_status" : 2,
    "update_time" : "2022-01-20T15:00:44.284053+08:00"
  }
}

Status Codes

Status Code

Description

200

success

501

unknown error

Error Codes

See Error Codes.