Get Issues List with All Values
Use Case
Use the REST API to get a list of issues with their custom field values.
Summary
To get a list of issues with their custom field values:
Use the Read a List of Issues request:
GET /api/issues?[fields]In the
fieldsparameter, specify the issue attributes that you want to return, including the relevant attributes ofcustomFields.Optionally, use the
queryrequest parameter to filter the issue list.
Step-by-Step
Start with a request for a single issue and its custom fields, then use the same pattern for the issues list.
Get an Issue with Its Custom Fields
To get an issue with values of all its custom fields, send a
GETrequest to the target issue. You can reference the issue by itsidReadablevalue, for exampleSP-8, or by its entityid, for example2-7.GET /api/issues/{issueID}?[fields]The
fieldsrequest parameter is the comma-separated list of attributes to return for the requested entity. In this example, the entity isIssue.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=id,idReadable,summary,customFields(id,projectCustomField(field(name)),value(name,login,fullName))$type— the entity type. YouTrack returns the$typefor all entities in the response regardless of whether you specify it in the request explicitly or not.id— a unique ID of the returned entity in the database.idReadable— the issue ID shown in the UI, for exampleSP-8.summary— the issue summary.customFields— an attribute of the returnedIssueentity that contains a collection of the issue custom fields. This is the target of our how-to.
The
customFields(...)expression is part of thefieldsparameter, not a separate query parameter. Here, we request the following attributes for each custom field:customFields(id,projectCustomField(field(name)),value(name,login,fullName))projectCustomField— eachIssueCustomFieldcontains settings of aProjectCustomFieldin a particular issue.field— eachProjectCustomFieldcontains settings of aCustomFieldin a particular project.projectCustomField(field(name))— returns the name of the custom field definition, for examplePriority,State, orAssignee.value— stores the custom field value for the issue. Depending on the field type, it can contain a primitive value, a linked entity, or a collection of values.
The final request is the following:
The response looks like this:
In this example, the issue contains the following custom fields: Priority, State, Assignee, Subsystem, Fix versions, and Fixed in build.
Get Issues List with Custom Fields
To return the same data for multiple issues, remove the {issueID} from the endpoint URL. For example:
To filter the list of returned issues, add the query parameter. For example, to return a subset of issues from a specific project:
To get a single issue by its readable ID, request it directly, for example: /api/issues/SP-8?fields=id,idReadable,summary,customFields(id,projectCustomField(field(name)),value(name)).
For more information about supported search expressions, see Query Syntax.