文档首页/ 需求管理 CodeArts Req/ API参考/ API/ IPD字段管理/ 查询工作项类型字段列表 - ListIssueFields
更新时间:2026-09-01 GMT+08:00
分享

查询工作项类型字段列表 - ListIssueFields

功能介绍

根据工作项类型查询字段列表。

调用方法

请参见如何调用API

授权信息

当前API调用无需身份策略权限。

URI

GET /v1/ipdprojectservice/projects/{project_id}/categories/{category_id}/field/templates

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释

项目32位ID,项目唯一标识。通过查询IPD项目列表获取,响应消息体中的id字段的值就是项目ID。

约束限制

不涉及。

取值范围

32个字符,由英文字母和数字组成。

默认取值

不涉及。

category_id

String

参数解释

工作项类型ID,工作项类型的唯一标识。

约束限制

不同项目模型下可选值不同:

  • IPD-系统设备类:10021(RR)、10065(SF)、10020(IR)、10022(SR)、10029(AR)、10027(Task)、10033(Bug)

  • IPD-独立软件类:10021(RR)、10065(SF)、10020(IR)、10023(US)、10027(Task)、10033(Bug)

  • IPD-自运营软件/云服务类:10001(Epic)、10028(FE)、10021(RR)、10023(US)、10027(Task)、10033(Bug)

  • 10001:Epic(史诗)

  • 10020:IR(研发需求)

  • 10021:RR(原始需求)

  • 10022:SR(分配需求)

  • 10023:US(用户故事)

  • 10027:Task(任务)

  • 10028:FE(特性)

  • 10029:AR(验收需求)

  • 10033:Bug(缺陷)

  • 10065:SF(系统特性)

取值范围

默认取值

不涉及。

表2 Query参数

参数

是否必选

参数类型

描述

page

Integer

参数解释

分页参数,页码。

约束限制

不涉及。

取值范围

1~100。

默认取值

1。

size

Integer

参数解释

分页参数,每页查询数据数量。

约束限制

不涉及。

取值范围

10-1000。

默认取值

20。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释

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

约束限制

不涉及。

取值范围

10~32768个字符。

默认取值

不涉及。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

page

PageVO object

参数解释: 分页信息。

result

Array of FieldVO objects

参数解释: 返回数据。

表5 PageVO

参数

参数类型

描述

page

String

参数解释

当前页。

取值范围

不涉及

size

String

参数解释

每页条数。

取值范围

不涉及

count

String

参数解释

数据总数。

取值范围

不涉及

表6 FieldVO

参数

参数类型

描述

id

String

参数解释

字段唯一标识。

取值范围

5~32个字符。

code

String

参数解释

字段编码。在项目中使用时一般使用code作为字段标识而不是字段ID。

取值范围

不涉及。

display_name

String

参数解释

字段显示名称。

取值范围

不涉及。

created_by

String

参数解释

字段创建人ID。

取值范围

不涉及。

created_date

String

参数解释

字段创建时间。时间戳格式,单位毫秒。

取值范围

不涉及。

modified_by

String

参数解释

字段最后修改人ID。

取值范围

不涉及。

modified_date

String

参数解释

字段最后修改时间。时间戳格式,单位毫秒。

取值范围

不涉及。

field_type

String

参数解释

字段类型标识。

取值范围

不涉及。

field_type_id

String

参数解释

字段类型ID。用于区分不同的字段类型。

取值范围

不涉及。

field_type_name

String

参数解释

字段类型名称。如单选列表、多选列表、多行文本等。

取值范围

不涉及。

definition_type

String

参数解释

字段定义类型。用于区分系统字段和自定义字段。

取值范围

  • 1:系统字段。

  • 2:系统字段。

  • 3:系统字段。

  • 4:租户自定义字段。

  • 5:项目自定义字段。

show_on_card

Boolean

参数解释

是否显示在云服务类型的迭代看板卡片模式中。

取值范围

  • true:显示。

  • false:不显示。

optional

Boolean

参数解释

字段是否为必填项。

取值范围

  • true:必填。

  • false:非必填。

controlled

Boolean

参数解释

字段是否受控。如果工作项已经基线,修改受控字段值时会触发变更评审。

取值范围

  • true:受控。

  • false:不受控。

immutable

Boolean

参数解释

字段是否不可变。更新接口无法更新不可变字段。

取值范围

  • true:不可变。

  • false:可变。

no

Integer

参数解释

字段排序序号。数值越小越靠前显示。

取值范围

0~9999的整数。

default_value

String

参数解释

字段默认值。创建工作项时自动填充。

取值范围

不涉及。

option

OptionEntity object

参数解释

字段选项。单选列表类型字段的选项信息,包含选项ID、编码、显示名称等属性。

取值范围

不涉及。

all_options

Array of OptionEntity objects

参数解释

字段所有选项。多选列表类型字段的全部选项信息,数组元素包含选项ID、编码、显示名称等属性。

取值范围

不涉及。

has_same_display_name

Boolean

参数解释

是否存在同名字段。用于检测字段名称冲突。

取值范围

  • true:存在同名字段。

  • false:不存在同名字段。

表7 OptionEntity

参数

参数类型

描述

id

String

参数解释

选项id。

取值范围

不涉及

code

String

参数解释

选项code值。

取值范围

不涉及

display_value

String

参数解释

选项名称。

取值范围

不涉及

value

String

参数解释

选项唯一标识。

取值范围

不涉及

level

Integer

参数解释

选项层级。用于区分层级字段的层级深度。

取值范围

1~4的整数,层级字段最多支持4层。

sequence

Integer

参数解释

选项排序序号。数值越小越靠前显示。

取值范围

0~2147483647。

parent_id

String

参数解释

父选项ID。层级选项中指向父级选项的标识,顶级选项为空或null。

取值范围

2~32个字符。

状态码:400

表8 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

错误码。

取值范围

不涉及。

error_msg

String

参数解释

错误描述,对error_code的补充解释。

取值范围

不涉及。

请求示例

GET https://{endpoint}/v1/ipdprojectservice/projects/05c7d8bcf3db4829bc841e4ba93aaea5/categories/10021/field/templates?page=1&size=10

响应示例

状态码:200

成功响应

{
  "page" : {
    "page" : 1,
    "size" : 10,
    "count" : 15
  },
  "result" : [ {
    "id" : "10042",
    "display_name" : "优先级",
    "created_by" : "系统",
    "field_type" : "pick",
    "show_on_card" : false,
    "optional" : true,
    "all_options" : [ {
      "id" : "1135144056192544813",
      "code" : "高",
      "display_value" : "高",
      "value" : "高",
      "level" : 1,
      "sequence" : 1
    } ],
    "default_value" : ""
  } ]
}

状态码:400

请求失败的响应。例如无操作权限、项目不存在。

{
  "error_code" : "PM.02174103",
  "error_msg" : "无操作权限"
}

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
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.projectman.v4.region.ProjectManRegion;
import com.huaweicloud.sdk.projectman.v4.*;
import com.huaweicloud.sdk.projectman.v4.model.*;


public class ListIssueFieldsSolution {

    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);

        ProjectManClient client = ProjectManClient.newBuilder()
                .withCredential(auth)
                .withRegion(ProjectManRegion.valueOf("<YOUR REGION>"))
                .build();
        ListIssueFieldsRequest request = new ListIssueFieldsRequest();
        request.withProjectId("{project_id}");
        request.withCategoryId("{category_id}");
        try {
            ListIssueFieldsResponse response = client.listIssueFields(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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkprojectman.v4 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 = ProjectManClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ProjectManRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListIssueFieldsRequest()
        request.project_id = "{project_id}"
        request.category_id = "{category_id}"
        response = client.list_issue_fields(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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/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 := projectman.ProjectManClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


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

    client := projectman.NewProjectManClient(hcClient)

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

更多

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

状态码

状态码

描述

200

成功响应

400

请求失败的响应。例如无操作权限、项目不存在。

错误码

请参见错误码

相关文档