更新时间:2026-10-22 GMT+08:00
分享

查询需求树 - ListIssueTree

功能介绍

此接口用于查询项目下的需求树,同页面 测试 -> 测试用例 -> 列表页左侧测试需求目录树状结构

调用方法

请参见如何调用API。

URI

POST /GT3KServer/v4/{project_id}/versions/{version_id}/issue-tree

表1 路径参数

参数

是否必选

参数类型

描述

project_id

是

String

参数解释:

项目UUID,项目唯一标识。获取方式请参见获取项目ID

约束限制:

不涉及

取值范围:

长度等于32位,包含大小写字母、数字

默认取值:

不涉及

version_id

是

String

参数解释

版本的唯一标识,用于指定查询需求树的目标版本。获取方式:从GET /v4/projects/{project_id}/iterator-infos的返回字段获取,或从GET /v1/{project_id}/branches的返回字段获取

约束限制

不涉及

取值范围

11~34位字母或数字

默认取值

不涉及

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

是

String

参数解释:

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

约束限制:

不涉及

取值范围:

字符串长度不少于1个字符,不超过100000个字符

默认取值:

不涉及

表3 请求Body参数

参数

是否必选

参数类型

描述

service_type

否

Integer

参数解释:

服务类型,用于筛选指定类型测试用例对应的需求

约束限制:

不涉及

取值范围:

  • -1:全量用例

  • 0:手工测试

  • 1:接口自动化

  • 7:功能自动化

  • 8:WebUI自动化

  • 100:自定义自动化(工厂)

  • 11:性能自动化

默认取值:

不涉及

service_types

否

Array of integers

参数解释

服务类型集合,用于同时筛选多种类型测试用例对应的需求。数组内整数值含义:-1表示全量用例,0表示手工测试,1表示接口自动化,7表示功能自动化,8表示WebUI自动化,100表示自定义自动化(工厂),11表示性能自动化

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

parent_id

否

String

参数解释

父节点id,用于指定查询的父节点。获取方式:从查询需求树接口的返回字段获取

约束限制

不涉及

取值范围

不超过128位的字母及数字组合

默认取值

不涉及

page_number

否

Integer

参数解释

页码

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

page_size

否

Integer

参数解释

每页数量

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

filter

否

IssueListFilterInfo object

参数解释

过滤条件

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

tracker_id

否

String

参数解释

工作项类型ID,用于按类型筛选需求。获取方式:从查询工作项类型接口的返回字段获取

约束限制

不涉及

取值范围

不超过64位的字母数字组合

默认取值

不涉及

module_id

否

String

参数解释

模块id,用于指定查询的模块范围。获取方式:从查询模块列表接口的返回字段获取

约束限制

不涉及

取值范围

1-32位字母及数字

默认取值

不涉及

task_uri

否

String

参数解释

任务uri,用于指定查询的任务范围。获取方式:从查询测试任务列表接口的返回字段获取

约束限制

不涉及

取值范围

字符串类型,长度为11-34位的字母或数字

默认取值

不涉及

include_sub_issue

否

Boolean

参数解释

是否统计子需求的用例数

约束限制

不涉及

取值范围

true:统计 false:不统计

默认取值

true

表4 IssueListFilterInfo

参数

是否必选

参数类型

描述

iteration_ids

否

Array of strings

参数解释

迭代id列表,用于按迭代筛选需求。数组内每个string为迭代的唯一标识,格式为字母及数字组合

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

pi_sprints

否

Array of IssueListPiFilterInfo objects

参数解释

PI过滤条件列表,用于按PI和迭代筛选需求。数组内每个IssueListPiFilterInfo对象包含pi_id和sprints信息,用于指定PI下的迭代范围

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

subject

否

String

参数解释

需求名

约束限制

不涉及

取值范围

长度不超过128位的字符串

默认取值

不涉及

module_id

否

String

参数解释

模块id,用于指定筛选的模块范围。获取方式:从查询模块列表接口的返回字段获取

约束限制

不涉及

取值范围

32位以内的字母及数字组合

默认取值

不涉及

status_id

否

String

参数解释

需求状态id,用于按状态筛选需求。获取方式:从查询工作项状态接口的返回字段获取

约束限制

不涉及

取值范围

32位以内的字母及数字

默认取值

不涉及

表5 IssueListPiFilterInfo

参数

是否必选

参数类型

描述

sprints

否

Array of strings

参数解释

迭代列表,用于指定PI下的迭代范围。数组内每个string为迭代的唯一标识

约束限制

不涉及

取值范围

不涉及

默认取值

不涉及

pi_id

否

String

参数解释

pi的id,层级关系:pi -> 迭代 -> 需求。获取方式:从查询PI列表接口的返回字段获取

约束限制

不涉及

取值范围

长度不超过128位的字符串

默认取值

不涉及

响应参数

状态码:200

表6 响应Body参数

参数

参数类型

描述

total

Integer

参数解释

总数

取值范围

不小于1的正整数

page_no

Integer

参数解释

当前页码

取值范围

大于0且小于100的正整数

page_size

Integer

参数解释

分页大小

取值范围

大于零且小于20000的正整数

value

Array of WorkItemVo objects

参数解释

需求列表,包含查询到的需求工作项信息。数组内每个WorkItemVo对象代表一个需求工作项的详细信息

取值范围

不涉及

has_more

Boolean

参数解释

是否有更多

取值范围

  • true:还有更多数据

  • false:没有更多数据

表7 WorkItemVo

参数

参数类型

描述

name

String

参数解释

工作项名称

取值范围

不涉及

owner

String

参数解释

处理人

取值范围

不涉及

path

String

参数解释

工作项路径

取值范围

不涉及

start_date

String

参数解释

预计开始日期,格式为yyyy-MM-dd

取值范围

不涉及

due_date

String

参数解释

预计结束日期,格式为yyyy-MM-dd

取值范围

不涉及

region

String

参数解释

逻辑region,使用公有云实际区域

取值范围

不涉及

creator

String

参数解释

创建人

取值范围

不涉及

updator

String

参数解释

更新人

取值范围

不涉及

project_uuid

String

参数解释

项目UUID,项目唯一标识

取值范围

不涉及

work_item_id

String

参数解释

工作项编号

取值范围

不涉及

status_id

String

参数解释

状态ID

取值范围

不涉及

status_name

String

参数解释

状态

取值范围

不涉及

tracker_id

String

参数解释

类型ID

取值范围

不涉及

tracker_name

String

参数解释

类型

取值范围

不涉及

iteration_id

String

参数解释

迭代ID

取值范围

不涉及

module_id

String

参数解释

模块ID

取值范围

不涉及

severity_id

String

参数解释

重要程度ID

取值范围

不涉及

severity_name

String

参数解释

重要程度

取值范围

不涉及

parent_workitem_id

String

参数解释

父工作项编号

取值范围

不涉及

board_id

String

参数解释

看板ID

取值范围

不涉及

board_name

String

参数解释

看板名称

取值范围

不涉及

create_time

String

参数解释

创建时间,格式为yyyy-MM-dd HH:mm:ss

取值范围

不涉及

update_time

String

参数解释

更新时间,格式为yyyy-MM-dd HH:mm:ss

取值范围

不涉及

iteration_name

String

参数解释

迭代名

取值范围

不涉及

module_name

String

参数解释

模块名

取值范围

不涉及

module_path

String

参数解释

模块path

取值范围

不涉及

module_path_name

String

参数解释

模块路径名称

取值范围

不涉及

owner_name

String

参数解释

处理人

取值范围

不涉及

have_child_dynamic

Boolean

参数解释

父工作项下是否有子工作项包含动态

取值范围

true:是 false:否

has_child

Boolean

参数解释

父工作项下是否有子工作项

取值范围

true:有子工作项 false:无子工作项

issue_dynamic_count

Integer

参数解释

需求动态数量

取值范围

不涉及

case_count

Integer

参数解释

用例数量

取值范围

不涉及

sequence_id

String

参数解释

xBoard项目工作项序列

取值范围

不涉及

pi_id

String

参数解释

pi的id,层级关系:pi -> 迭代 -> 需求

取值范围

不涉及

pi_name

String

参数解释

pi名称

取值范围

不涉及

状态码:400

表8 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:401

表9 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:404

表10 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

状态码:500

表11 响应Body参数

参数

参数类型

描述

code

String

参数解释:

业务失败的错误码

取值范围:

不涉及

reason

String

参数解释:

业务失败的提示内容

取值范围:

不涉及

请求示例

POST https://{endpoint}/GT3KServer/v4/90f8dc52eb7b4c47b853c661152ca62d/versions/v902000108vdtjkp/issue-tree

{
  "service_type" : 1,
  "service_types" : [ 0, 1, 6 ],
  "parent_id" : "12345",
  "page_number" : 1,
  "page_size" : 10,
  "filter" : { },
  "tracker_id" : "5,6,7",
  "module_id" : "1233",
  "task_uri" : "12313",
  "include_sub_issue" : false
}

响应示例

状态码:200

{
  "total" : 2,
  "value" : [ {
    "name" : "1",
    "work_item_id" : "1186322840050868225",
    "tracker_id" : "7",
    "tracker_name" : "IR",
    "have_child_dynamic" : false,
    "has_child" : false,
    "issue_dynamic_count" : 0,
    "case_count" : 1,
    "sequence_id" : "IR20251018975242"
  }, {
    "name" : "1事务所",
    "work_item_id" : "1176931421586595840",
    "tracker_id" : "3",
    "tracker_name" : "Bug",
    "have_child_dynamic" : false,
    "has_child" : false,
    "issue_dynamic_count" : 0,
    "case_count" : 0,
    "sequence_id" : "BUG20250922897940"
  } ],
  "page_size" : 10,
  "page_no" : 1,
  "has_more" : false
}

SDK代码示例

SDK代码示例如下。

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.*;

import java.util.List;
import java.util.ArrayList;

public class ListIssueTreeSolution {

    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();
        ListIssueTreeRequest request = new ListIssueTreeRequest();
        request.withVersionId("{version_id}");
        request.withProjectId("{project_id}");
        QueryIssueTreeInfo body = new QueryIssueTreeInfo();
        List<Integer> listbodyServiceTypes = new ArrayList<>();
        listbodyServiceTypes.add(0);
        listbodyServiceTypes.add(1);
        listbodyServiceTypes.add(6);
        body.withIncludeSubIssue(false);
        body.withTaskUri("12313");
        body.withModuleId("1233");
        body.withTrackerId("5,6,7");
        body.withPageSize(10);
        body.withPageNumber(1);
        body.withParentId("12345");
        body.withServiceTypes(listbodyServiceTypes);
        body.withServiceType(1);
        request.withBody(body);
        try {
            ListIssueTreeResponse response = client.listIssueTree(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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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 = ListIssueTreeRequest()
        request.version_id = "{version_id}"
        request.project_id = "{project_id}"
        listServiceTypesbody = [
            0,
            1,
            6
        ]
        request.body = QueryIssueTreeInfo(
            include_sub_issue=False,
            task_uri="12313",
            module_id="1233",
            tracker_id="5,6,7",
            page_size=10,
            page_number=1,
            parent_id="12345",
            service_types=listServiceTypesbody,
            service_type=1
        )
        response = client.list_issue_tree(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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := cloudtest.CloudtestClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := cloudtest.NewCloudtestClient(hcClient)

    request := &model.ListIssueTreeRequest{}
	request.VersionId = "{version_id}"
	request.ProjectId = "{project_id}"
	var listServiceTypesbody = []int32{
        int32(0),
	    int32(1),
	    int32(6),
    }
	includeSubIssueQueryIssueTreeInfo:= false
	taskUriQueryIssueTreeInfo:= "12313"
	moduleIdQueryIssueTreeInfo:= "1233"
	trackerIdQueryIssueTreeInfo:= "5,6,7"
	pageSizeQueryIssueTreeInfo:= int32(10)
	pageNumberQueryIssueTreeInfo:= int32(1)
	parentIdQueryIssueTreeInfo:= "12345"
	serviceTypeQueryIssueTreeInfo:= int32(1)
	request.Body = &model.QueryIssueTreeInfo{
		IncludeSubIssue: &includeSubIssueQueryIssueTreeInfo,
		TaskUri: &taskUriQueryIssueTreeInfo,
		ModuleId: &moduleIdQueryIssueTreeInfo,
		TrackerId: &trackerIdQueryIssueTreeInfo,
		PageSize: &pageSizeQueryIssueTreeInfo,
		PageNumber: &pageNumberQueryIssueTreeInfo,
		ParentId: &parentIdQueryIssueTreeInfo,
		ServiceTypes: &listServiceTypesbody,
		ServiceType: &serviceTypeQueryIssueTreeInfo,
	}
	response, err := client.ListIssueTree(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

404

Not Found

500

Internal Server Error

错误码

请参见错误码。

相关文档