Get Issues List with All Values
Use Case:
Use the REST API to get a list of issues with all their custom fields.
Summary
To get a list of issues with all their custom fields:
Use Get Issues List request:
GET /api/issues?[fields]In the
fields
request parameter specify issue attributes you want to get in response including necessary attributes of itscustomFields
.
Step-by-Step
We will start with a piece-by-piece description of the request to get a specific issue with its custom fields. Then, we extrapolate the principe to the issues list.
Get an Issue with Its Custom Fields
-
To get an issue with values of all its custom fields, send a
GET
request to the target issue. You can use either issueidReadable
(for example,SP-8
) or issues's entityid
(for example,2-7
) to reference issue.GET /api/issues/{issueID}?[fields] -
The
fields
request parameter is the comma-separated list of the returned entity (in this case - Issue) attributes to return in the server response.You can request any set of supported attributes of the returned entity. For an issue, see the list of supported attributes.
In this how-to, we request the following data:
?fields=$type,id,summary,customFields($type,id,projectCustomField($type,id,field($type,id,name)),value($type,avatarUrl,buildLink,color(id),fullName,id,isResolved,localizedName,login,minutes,name,presentation,text))'$type
- the entity type. YouTrack returns the$type
for all entities in the response regardless of whether you specify it in request explicitly or not.id
- a unique ID of the returned entity in the database.summary
- issue summary.customFields
- an attribute of the returnedIssue
entity that contains a collection of the issue custom fields. This is the target of our how-to.
-
Notice the attributes we get for custom fields:
?customFields($type,id,projectCustomField($type,id,field($type,id,name)),value($type,avatarUrl,buildLink,color(id),fullName,id,isResolved,localizedName,login,minutes,name,presentation,text))'projectCustomField
- eachIssueCustomField
contains settings of aProjectCustomField
in a particular issue.field
- respectively, eachProjectCustomField
contains settings of aCustomField
in a particular project.value
- whereasCustomField
is the most common entity,IssueCustomField
is the most special and includes field value in a particular issue. Value can be just a simple one (string, integer,..), link to some entity (link to particular user for Assignee field) or a collection of values (Affected versions field). So, we getvalue
attributes for all its types.
The final request is the following:
The server response is the following:
Get Issues List with Custom Fields
To get this data for each issue, simply remove the {issueID}
from the endpoint URL. For example: