Querying the Work Item Instance Field List
Function
Query the field configuration information available during work item instance creation, including system fields and custom fields.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
GET /v1/ipdprojectservice/projects/{project_id}/categories/{category_id}/fields
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition 32-character ID of a project, which must be unique. Obtain the value by calling the API for querying the IPD project list. The value of id in the response message body is the project ID. Constraints N/A Range A string of 32 characters consisting of letters and digits. Default Value N/A |
| category_id | Yes | String | Definition Work item type ID, which uniquely identifies a work item type. Constraints The available values vary with the project model:
Range Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| category_layer_id | No | String | Definition Level field ID. Field used to filter level types. This parameter is passed when fields need to be filtered by level structure. Constraints N/A Range 5 to 32 characters. Default Value N/A |
| target_project_id | No | String | Definition 32-character ID of the target project, which must be unique. Obtain the value by calling the Querying the IPD Project List API. The value of id in the response message body is the project ID. This parameter is passed when you need to query the field configuration of other projects. Constraints N/A Range 32 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints N/A Range 10 to 32,768 characters Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Response code. Processing result of the request for querying the work item instance field list. Range |
| message | String | Definition Response message. If the request fails, detailed error information is included, which can be used for troubleshooting. Range N/A |
| result | Array of FieldVO objects | Definition Field list result. Field configuration information that can be selected during work item instance creation, including the field ID, code, name, and type. The information includes system fields and custom fields. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Unique ID of a field. Range 5 to 32 characters. |
| code | String | Definition Field code. In a project, the code is generally used as the field identifier instead of the field ID. Range N/A |
| display_name | String | Definition Field display name. Range N/A |
| created_by | String | Definition ID of the field creator. Range N/A |
| created_date | String | Definition Creation time of a field. Timestamp format, in milliseconds. Range N/A |
| modified_by | String | Definition ID of the last person who modified the field. Range N/A |
| modified_date | String | Definition Time when a field was last modified. Timestamp format, in milliseconds. Range N/A |
| field_type | String | Definition Field type identifier. Range N/A |
| field_type_id | String | Definition Field type ID. It is used to distinguish different field types. Range N/A |
| field_type_name | String | Definition Field type name. For example, single-choice list, multi-choice list, and multi-line text. Range N/A |
| definition_type | String | Definition Field definition type. Used to distinguish system fields from custom fields. Range - 1: system field |
| optional | Boolean | Definition Whether the field is mandatory. Range |
| controlled | Boolean | Definition Whether the field is controlled. If a work item has been baselined, changing the value of a controlled field will trigger a change review. Range |
| immutable | Boolean | Definition Whether the field is immutable. The update API cannot update immutable fields. Range |
| no | Integer | Definition Field sequence number. Smaller values are displayed first. Range An integer ranging from 0 to 9999. |
| default_value | String | Definition Default value of a field. Automatically filled when a work item is created. Range N/A |
| option | OptionEntity object | Definition Field option. Options of a single-choice list field, including the option ID, code, and display name. Range N/A |
| all_options | Array of OptionEntity objects | Definition All options of a field. All options of a multi-choice list field. The array elements include the option ID, code, and display name. Range N/A |
| has_same_display_name | Boolean | Definition Whether fields with the same name exist. It is used to detect field name conflicts. Range |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Option ID. Range N/A |
| code | String | Definition Code value of an option. Range N/A |
| display_value | String | Definition Option name. Range N/A |
| value | String | Definition Unique option ID. Range N/A |
| level | Integer | Definition Number of option levels. Range The value is an integer ranging from 1 to 4. |
| sequence | Integer | Definition Sequence number of an option. Smaller values are displayed first. Range 0 to 2147483647 |
| parent_id | String | Definition Parent option ID. Identifier of the parent option in the level option. The top option is empty or null. Range 2 to 32 characters. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error description, which is a supplement to error_code. Range N/A |
Example Requests
Querying the work item instance field list
GET https://{endpoint}/v1/ipdprojectservice/projects/8e70d806a8f04d018ea6af6b6ffe7b96/categories/10021/fields Example Responses
Status code: 200
{
"status" : "success",
"result" : [ {
"id" : "10042",
"code" : "priority",
"display_name" : "Priority.",
"created_by" : "System",
"created_date" : "1705476103000",
"modified_by" : "System",
"modified_date" : "1705476103000",
"field_type" : "pick",
"field_type_id" : "10001",
"field_type_name" : "Single-choice list",
"definition_type" : "1",
"show_on_card" : false,
"optional" : true,
"controlled" : false,
"immutable" : false,
"default_value" : "",
"no" : 1,
"option" : [ {
"id" : "1135144056192544813",
"display_value" : "High",
"value" : "High",
"code" : "High",
"sequence" : 0,
"level" : 1
}, {
"id" : "1135144056192544814",
"display_value" : "Medium",
"value" : "Medium",
"code" : "Medium",
"sequence" : 1,
"level" : 1
}, {
"id" : "1135144056192544815",
"display_value" : "Low",
"value" : "Low",
"code" : "Low",
"sequence" : 2,
"level" : 1
} ]
} ]
} Status code: 400
{
"error_code" : "PM.02174103",
"error_msg" : "Invalid pagination parameter."
} SDK Sample Code
The SDK 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 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) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Error cause. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot