Help Center/ CodeArts TestPlan/ API Reference/ APIs/ Test Plan Management/ Adding Test Cases In Batches to a Plan
Updated on 2026-06-22 GMT+08:00

Adding Test Cases In Batches to a Plan

Function

This API is used to add test cases in batches to a test plan.

Calling Method

For details, see Calling APIs.

URI

POST /v1/projects/{project_id}/plans/{plan_id}/testcases/batch-add

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project UUID, which uniquely identifies a project. For details about how to obtain the project UUID, see Obtaining a Project ID.

Constraints

32 characters (letters and digits).

Range

N/A.

Default Value

N/A.

plan_id

Yes

String

Definition

Unique identifier of a plan.

Constraints

N/A.

Range

11 to 34 characters.

Default Value

N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A.

Range

1 to 100,000 characters.

Default Value

N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

service_id

Yes

Integer

Definition

Service ID returned by the API for registering a test service.

Constraints

N/A.

Range

N/A.

Default Value

N/A.

testcase_id_list

Yes

Array of strings

Definition

Number of cases in a plan.

Constraints

It must involve only one test type.

Range

Fewer than 50 elements.

Default Value

N/A.

Response Parameters

Status code: 204

OK

Status code: 400

Bad Request

Status code: 401

Unauthorized

Status code: 404

Not Found

Status code: 500

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code displayed after the API fails to be called.

Range

N/A.

error_msg

String

Definition

Error message displayed after the API fails to be called.

Range

N/A.

Example Requests

Add test cases in batches to a plan.

post https://{endpoint}/v1/projects/efdb403066474ab08836b9eeaaa23bca/plans/9b26f58ec29943f681804a6628779a23/testcases/batch-add

{
  "service_id" : 13,
  "testcase_id_list" : [ "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de", "97b82412f1ca4628803b918c27ed09de" ]
}

Example Responses

Status code: 200

OK

{
  "status" : "success",
  "result" : {
    "value" : "success"
  }
}

Status code: 500

Internal server error

{
  "error_code" : "CLOUDTEST.00000001",
  "error_msg" : "error message displayed after an API fails to be called"
}

Status Codes

Status Code

Description

200

OK

400

Bad request

401

Unauthorized

404

Not found

500

Internal server error

Error Codes

See Error Codes.