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

查询工作项实例字段列表 - ShowIpdFieldsV2

功能介绍

查询创建工作项实例时可用的字段配置信息,包含系统字段和项目自定义字段。

调用方法

请参见如何调用API

授权信息

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

URI

GET /v1/ipdprojectservice/projects/{project_id}/categories/{category_id}/fields

表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参数

参数

是否必选

参数类型

描述

category_layer_id

String

参数解释

层级字段ID。用于过滤层级类型的字段,当需要按层级结构筛选字段时传入。

约束限制

不涉及。

取值范围

5~32个字符。

默认取值

不涉及。

target_project_id

String

参数解释

目标项目32位ID,项目唯一标识。通过查询IPD项目列表获取,响应消息体中的id字段的值就是项目ID。当需要查询其他项目的字段配置时传入。

约束限制

不涉及。

取值范围

32个字符。

默认取值

不涉及。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释

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

约束限制

不涉及。

取值范围

10~32768个字符。

默认取值

不涉及。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

status

String

参数解释

响应状态码。标识查询工作项实例字段列表请求的处理结果。

取值范围

  • success:查询工作项实例字段列表成功。

  • failed:查询工作项实例字段列表失败。

message

String

参数解释

响应消息。请求失败时包含详细错误信息,可用于问题排查。

取值范围

不涉及。

result

Array of FieldVO objects

参数解释

字段列表结果。返回创建工作项实例时可选用的字段配置信息,包含字段ID、编码、名称、类型等属性,包含系统字段和项目自定义字段。

取值范围

不涉及。

表5 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:不存在同名字段。

表6 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

表7 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

错误码。

取值范围

不涉及。

error_msg

String

参数解释

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

取值范围

不涉及。

请求示例

查询工作项实例字段列表

GET https://{endpoint}/v1/ipdprojectservice/projects/8e70d806a8f04d018ea6af6b6ffe7b96/categories/10021/fields

响应示例

状态码:200

OK

{
  "status" : "success",
  "result" : [ {
    "id" : "10042",
    "code" : "priority",
    "display_name" : "优先级",
    "created_by" : "系统",
    "created_date" : "1705476103000",
    "modified_by" : "系统",
    "modified_date" : "1705476103000",
    "field_type" : "pick",
    "field_type_id" : "10001",
    "field_type_name" : "单选列表",
    "definition_type" : "1",
    "show_on_card" : false,
    "optional" : true,
    "controlled" : false,
    "immutable" : false,
    "default_value" : "",
    "no" : 1,
    "option" : [ {
      "id" : "1135144056192544813",
      "display_value" : "高",
      "value" : "高",
      "code" : "高",
      "sequence" : 0,
      "level" : 1
    }, {
      "id" : "1135144056192544814",
      "display_value" : "中",
      "value" : "中",
      "code" : "中",
      "sequence" : 1,
      "level" : 1
    }, {
      "id" : "1135144056192544815",
      "display_value" : "低",
      "value" : "低",
      "code" : "低",
      "sequence" : 2,
      "level" : 1
    } ]
  } ]
}

状态码: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 ShowIpdFieldsV2Solution {

    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();
        ShowIpdFieldsV2Request request = new ShowIpdFieldsV2Request();
        request.withProjectId("{project_id}");
        request.withCategoryId("{category_id}");
        try {
            ShowIpdFieldsV2Response response = client.showIpdFieldsV2(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 = ShowIpdFieldsV2Request()
        request.project_id = "{project_id}"
        request.category_id = "{category_id}"
        response = client.show_ipd_fields_v2(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.ShowIpdFieldsV2Request{}
	request.ProjectId = "{project_id}"
	request.CategoryId = "{category_id}"
	response, err := client.ShowIpdFieldsV2(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多

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

状态码

状态码

描述

200

OK

400

错误原因

错误码

请参见错误码

相关文档