Help Center/ CodeArts TestPlan/ API Reference/ APIs/ Test Plan Management/ Querying the Test Plan List in a Project (V2)
Updated on 2025-09-04 GMT+08:00

Querying the Test Plan List in a Project (V2)

Function

This API is used to query the test plan list in a project (V2).

Calling Method

For details, see Calling APIs.

URI

GET /v2/projects/{project_id}/plans

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.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

Yes

Integer

Definition

The position where the query starts.

Constraints

N/A.

Range

Greater than or equal to 0.

Default Value

N/A.

limit

Yes

Integer

Definition

Number of items displayed on each page.

Constraints

N/A.

Range

0–100

Default Value

N/A.

name

No

String

Definition

Used for fuzzy query (for test plan names).

Constraints

N/A.

Range

N/A.

Default Value

N/A.

current_stage

No

String

Definition

Stage of the test plan.

Constraints

N/A.

Range

create, design, execute, report

Default Value

N/A.

fix_version_ids

No

String

Definition

Sprint associated with the test plan.

Constraints

N/A.

Range

Sprint IDs are separated by commas (,).

Default Value

N/A.

branch_uri

No

String

Definition

Branch URI.

Constraints

N/A.

Range

N/A.

Default Value

master

query_all_version

No

Boolean

Definition

Whether to query test plans of all versions.

Constraints

N/A.

Range

false: Query test plans in the branches specified in the branch_uri field. If branch_uri is left empty, the master branch will be queried by default.

true: Query test plans of all versions.

Default Value

false

Request Parameters

Table 3 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.

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

[Array elements]

Array of TestPlanDetail objects

Response structure for querying the test plan list in a project.

Table 5 TestPlanDetail

Parameter

Type

Description

creator

creator object

Definition

Test plan creator information.

Range

N/A.

current_stage

String

Definition

Stage of the current test plan.

Range

N/A.

design_stage

design_stage object

Definition

Information about the test plan design stage.

Range

N/A.

end_date

String

Definition

Test plan deadline.

Range

N/A.

execute_stage

execute_stage object

Definition

Information about the test plan execution stage.

Range

N/A.

expire_day

Integer

Definition

Overdue days. A positive value indicates that the plan has expired.

Range

N/A.

finish_date

String

Definition

Actual completion time of the test plan (when all test cases under the test plan are completed.)

Range

N/A.

iteration

NameAndId object

Definition

Sprint No. and name of the test plan.

Range

N/A.

name

String

Definition

Test plan name.

Range

N/A.

owner

owner object

Definition

Test plan processor information.

Range

N/A.

plan_id

String

Definition

Test plan ID.

Range

N/A.

project_id

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.

report_stage

report_stage object

Definition

Statistics at the reporting stage.

Range

N/A.

start_date

String

Definition

Test plan start time.

Range

N/A.

Table 6 creator

Parameter

Type

Description

id

String

Definition

ID of the test plan creator.

Range

N/A.

nick_name

String

Definition

Nickname of the test plan creator.

Range

This field is not returned if the user does not set the nickname.

user_name

String

Definition

Name of the test plan creator.

Range

N/A.

Table 7 design_stage

Parameter

Type

Description

case_count

Integer

Definition

Number of test cases.

Range

N/A.

issue_count

Integer

Definition

Number of requirements.

Range

N/A.

issue_covered_count

String

Definition

Number of requirements associated with test cases.

Range

N/A.

Table 8 execute_stage

Parameter

Type

Description

case_pass_rate

String

Definition

Test case pass rate, calculated by test case results.

Range

N/A.

completed_defect_count

Integer

Definition

Number of completed bugs.

Range

N/A.

defect_count

Integer

Definition

Number of bugs.

Range

N/A.

executed_case_count

Integer

Definition

Number of executed test cases, calculated by test case status.

Range

N/A.

Table 9 NameAndId

Parameter

Type

Description

id

String

Definition

Object ID.

Range

N/A.

name

String

Definition

Object name.

Range

N/A.

Table 10 owner

Parameter

Type

Description

id

String

Definition

Test plan processor ID.

Range

N/A.

name

String

Definition

Name of the test plan processor. nickName is returned if it exists, otherwise userName is returned.

Range

N/A.

nick_name

String

Definition

Alias of the test plan processor. This parameter is not returned if the user does not set an alias.

Range

N/A.

user_name

String

Definition

Username of the test plan processor.

Range

N/A.

Table 11 report_stage

Parameter

Type

Description

case_complete_rate

String

Definition

Case completion rate, calculated by status.

Range

0%-100%

Status code: 400

Table 12 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.

Status code: 401

Table 13 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.

Status code: 404

Table 14 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.

Status code: 500

Table 15 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

get https://{endpoint}/v2/projects/efdb403066474ab08836b9eeaaa23bca/plans?offset=1&limit=10&name&current_stage

Example Responses

Status code: 201

OK

[ {
  "creator" : {
    "id" : "efdb403066474ab08836b9eeaaa23bca",
    "nick_name" : "Tester",
    "user_name" : "Tester"
  },
  "current_stage" : "design",
  "design_stage" : {
    "case_count" : 2,
    "issue_count" : 0,
    "issue_covered_count" : "0"
  },
  "end_date" : "2021-07-10",
  "execute_stage" : {
    "case_pass_rate" : "0.00%",
    "completed_defect_count" : 0,
    "defect_count" : 0,
    "executed_case_count" : 0
  },
  "expire_day" : -4,
  "finish_date" : "2021-07-10",
  "iteration" : {
    "id" : "ID",
    "name" : "Name"
  },
  "name" : "Test",
  "owner" : {
    "id" : "efdb403066474ab08836b9eeaaa23bca",
    "name" : "Tester",
    "nick_name" : "Tester",
    "user_name" : "Tester"
  },
  "plan_id" : "c7c2ddf2ea914164ac6ee76bf11a30ea",
  "project_id" : "9b26f58ec29943f681804a6628779a23",
  "report_stage" : {
    "case_complete_rate" : "100.00%"
  },
  "start_date" : "2021-07-10"
} ]

SDK Sample Code

The sample code is as follows.

Java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cloudtest.v1.region.CloudtestRegion;
import com.huaweicloud.sdk.cloudtest.v1.*;
import com.huaweicloud.sdk.cloudtest.v1.model.*;


public class ShowPlanListSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        CloudtestClient client = CloudtestClient.newBuilder()
                .withCredential(auth)
                .withRegion(CloudtestRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowPlanListRequest request = new ShowPlanListRequest();
        request.withProjectId("{project_id}");
        try {
            ShowPlanListResponse response = client.showPlanList(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcloudtest.v1.region.cloudtest_region import CloudtestRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcloudtest.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = CloudtestClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CloudtestRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowPlanListRequest()
        request.project_id = "{project_id}"
        response = client.show_plan_list(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    cloudtest "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cloudtest.NewCloudtestClient(
        cloudtest.CloudtestClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowPlanListRequest{}
	request.ProjectId = "{project_id}"
	response, err := client.ShowPlanList(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More SDK Sample Code

For SDK code examples in more programming languages, visit API Explorer and click the Sample Code tab.

Status Codes

Status Code

Description

201

OK

400

Bad request

401

Unauthorized

404

Not found

500

Internal server error

Error Codes

See Error Codes.