Querying Template Field Configurations
Function
This API is used to query the template field configuration list of a project. You can specify tracker_id to filter templates of a specific work item type.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
GET /v2/projects/{project_id}/field-templates
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: 32-character UUID of a project, which uniquely identifies a project. Obtain the value of this parameter from the project_id field in the response body of the Querying the Project List API. Constraints: The value must contain 32 characters. Digits and letters are allowed. Value range: N/A 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 The value contains 10 to 32,768 characters. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| result | result object | Definition Returned result, including the template field configuration information. Range N/A |
| status | String | Definition Request result. Range |
| Parameter | Type | Description |
|---|---|---|
| templates | Array of templates objects | Definition Template list, including the configuration information of multiple templates. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| template_id | String | Definition Template ID, which uniquely identifies a template. Range N/A |
| tracker_id | Integer | Definition Work item type ID, which identifies the work item type to which the template belongs. Range |
| tracker_name | String | Definition Work item type name, corresponding to the name of tracker_id. Range N/A |
| description | String | Definition Template description, which describes the usage or function of the template. Range N/A |
| fields | Array of fields objects | Definition Field configuration list, including the configuration information of all fields in the template. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| custom | Boolean | Definition Whether the field is a custom field. true or false. Range |
| field | String | Definition Field ID, which uniquely identifies a field. Range N/A |
| field_type | String | Definition Field type, which describes the data type or display mode of a field. Range |
| type_options | String | Definition Field type options, which describe the optional configurations of the field type. Range N/A |
| default_value | String | Definition Default value of a field, which is the initial value when a work item is created. field_type. Range N/A |
| default_option | default_option object | Definition Default option, which is the default option when the field type is drop-down list. Range N/A |
| is_visible | Boolean | Definition Whether the field is displayed. Range |
| position | Integer | Definition Field display sequence. Fields with smaller values appear before fields with larger values. Range A positive integer. |
| is_required | Integer | Definition Whether the field is mandatory. 0 or 1. Range |
| last | Boolean | Definition Whether the field is the last one in the group. true or false. Range |
| option | Array of option objects | Definition List of options for a field. This parameter is valid only when the field type is drop-down list. Range N/A |
| field_name | String | Definition Field name displayed to users. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Option ID. Range N/A |
| name | String | Definition Option name. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Option ID. Range N/A |
| name | String | Definition Option name. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Requests
Querying all templates and their field configurations in a project
GET https://{endpoint}/v2/projects/a6a33eca679b435b85574bd2fde46ce7/field-templates?tracker_id=7 Example Responses
Status code: 200
{
"result" : {
"templates" : [ {
"id" : 384006,
"name" : "12345",
"description" : "",
"tracker_id" : 7,
"field_configs" : [ {
"field" : "module_id",
"name" : "Module",
"field_type" : "select",
"is_required" : 0,
"is_visible" : true,
"position" : 3
}, {
"field" : "fixed_version_id",
"name" : "Iteration",
"field_type" : "select",
"is_required" : 0,
"is_visible" : true,
"position" : 4
} ]
} ]
},
"status" : "success"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response to a successful request for querying the template field configuration list in a project. |
| 400 | Response to an interface request failure. |
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