Querying Fields
Function
This API is used to query the field list by page. Keywords, including title, field type, and creator, can be used for query.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
GET /v1/ipdprojectservice/projects/{project_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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| keyword | No | String | Definition Keyword search by title, field type, and creator. Constraints N/A Range N/A Default Value N/A |
| offset | No | Integer | Definition Start page number. The value starts from 0 and is an integer multiple of limit. Constraints The value must be a multiple of limit. Range ≥ 0 Default Value 0 |
| limit | No | Integer | Definition Page size. Constraints N/A Range ≥ 1 Default Value 20 |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Response status. Range |
| message | String | Definition Request failure information. Range N/A |
| result | FieldListResult object | Definition Field list. |
| Parameter | Type | Description |
|---|---|---|
| data | Array of FieldEntity objects | Definition Field list. |
| total | Integer | Definition Total number of fields in a project. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| display_name | String | Definition Field name. Range N/A |
| code | String | Definition Field code. Range N/A |
| id | String | Definition Field ID. Range N/A |
| description | String | Definition Field description. Range N/A |
| created_by | String | Definition Field creator name. Range N/A |
| created_date | String | Definition Time when a field is created, in timestamp format, for example, 1715305846000. Range N/A |
| modified_by | String | Definition Name of the user who last updated the field. Range N/A |
| definition_type | String | Definition Field level. Range |
| field_type_name | String | Definition Field type name. Range N/A |
| required | Boolean | Definition Whether the field is mandatory in the work item. If the configuration is inconsistent with the workflow configuration, the workflow configuration prevails. Range |
| controlled | Boolean | Definition Whether the field is controlled in the work item. To modify a controlled field of a baselined work item, a change review process is required. If the configuration is inconsistent with the workflow configuration, the workflow configuration prevails. Range |
| immutable | Boolean | Definition Whether the field is not modifiable in the work item. If the configuration is inconsistent with the workflow configuration, the workflow configuration prevails. Range |
| no | Integer | Definition Field sequence number. Range N/A |
| all_options | Array of OptionEntity objects | Definition Field option. |
| support_hiding | Boolean | Definition Whether the field can be hidden. Range |
| default_value_editable | Boolean | Definition Whether the default value of the field is editable. Range |
| field_id | String | Definition Field ID. Range N/A |
| using_status | Boolean | Definition Whether the field is in use. Range |
| required_editable | Boolean | Definition Whether the field is mandatory and editable. Range |
| controlled_editable | Boolean | Definition Whether the field is controlled and editable. Range |
| option_source | String | Definition Field option source. Range N/A |
| show_on_split | Boolean | Definition Whether the field is displayed during splitting. Range |
| show_on_filter | Boolean | Definition Whether the field is displayed during filtering. Range |
| show_on_edit | Boolean | Definition Whether the field is displayed during editing. Range |
| show_on_table | Boolean | Definition Whether the field is displayed in the table. Range |
| sort_on_table | Boolean | Definition Whether the field is sorted in the table. Range |
| config_on_card | Boolean | Definition Whether the field is configured in the card. Range |
| card_field_seq | Integer | Definition Card field sorting sequence number. Range N/A |
| has_update_privilege | Boolean | Definition Whether the user has permission to update the field. 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. |
Example Requests
Querying fields by keyword
GET https://{endpoint}/v1/ipdprojectservice/projects/b54914d464d1498a97d683ef198ec448/fields?offset=0&limit=1 Example Responses
Status code: 200
{
"status" : "success",
"result" : {
"data" : [ {
"display_name" : "Subtitle",
"code" : "c7186197833374113792",
"id" : "994277015639076864",
"description" : "222222222222",
"created_by" : "Test alias",
"created_date" : "1715305846000",
"modified_by" : "Test alias",
"definition_type" : "4",
"field_type_name" : "Multi-line text",
"required" : false,
"controlled" : false,
"immutable" : false,
"no" : 9999
} ],
"total" : 1
}
} 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 | 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 ListIpdProjectFieldsSolution { 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(); ListIpdProjectFieldsRequest request = new ListIpdProjectFieldsRequest(); request.withProjectId("{project_id}"); try { ListIpdProjectFieldsResponse response = client.listIpdProjectFields(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 | # 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 = ListIpdProjectFieldsRequest() request.project_id = "{project_id}" response = client.list_ipd_project_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 | 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.ListIpdProjectFieldsRequest{} request.ProjectId = "{project_id}" response, err := client.ListIpdProjectFields(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 |
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