Querying the Field List by Work Item Type
Function
This API is used to query the field list by work item type.
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}/field/templates
| 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 Available values vary by project model:
Custom requirement model projects: Obtain the value by calling the Obtaining the Model Tree Configuration API. The value of the id field in categories in the response body is the work item type ID. Range Custom requirement model projects: Obtain the value by calling the Obtaining the Model Tree Configuration API. The value of the id field in categories in the response body is the work item type ID. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| page | No | Integer | Definition Page number. Constraints N/A Range 1–100 Default Value 1 |
| size | No | Integer | Definition Number of records on each page. Constraints N/A Range 10 to 1000 Default Value 20 |
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 |
|---|---|---|
| page | PageVO object | Definition: Pagination information. |
| result | Array of FieldVO objects | Definition: Returned data. |
| Parameter | Type | Description |
|---|---|---|
| page | String | Definition Current page. Range N/A |
| size | String | Definition Number of records on each page. Range N/A |
| count | String | Definition Total number. 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 |
| show_on_card | Boolean | Definition Whether to display in the sprint dashboard card mode of the cloud service type. Range |
| 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
GET https://{endpoint}/v1/ipdprojectservice/projects/05c7d8bcf3db4829bc841e4ba93aaea5/categories/10021/field/templates?page=1&size=10 Example Responses
Status code: 200
{
"page" : {
"page" : 1,
"size" : 10,
"count" : 15
},
"result" : [ {
"id" : "10042",
"display_name" : "Priority",
"created_by" : "System",
"field_type" : "pick",
"show_on_card" : false,
"optional" : true,
"all_options" : [ {
"id" : "1135144056192544813",
"code" : "High",
"display_value" : "High",
"value" : "High",
"level" : 1,
"sequence" : 1
} ],
"default_value" : ""
} ]
} Status code: 400
{
"error_code" : "PM.02174103",
"error_msg" : "No permission."
} 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 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) } } |
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 | Success response. |
| 400 | Response upon a request failure. For example, the user does not have the operation permission or the project does not exist. |
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