Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to limit the fields in the JIRA Rest response

Kepio
Contributor
June 19, 2013

I'm trying to retrieve the assignee email address and project key from a JIRA search query via REST call - I can't seem to limit the returned fields to just theses 2 fields.

Example:

https://jira.atlassian.com/rest/api/2/search?startAt=2&jql=project%3DANERDS+and+updated+%3E+2013-04-29&fields=project,assignee&maxResults=2

will return

{
expand: "schema,names",
startAt: 2,
maxResults: 2,
total: 38,
issues:  [
 {
expand: "editmeta,renderedFields,transitions,changelog,operations",
id: "280877",
self: "https://jira.atlassian.com/rest/api/2/issue/280877",
key: "ANERDS-473",
fields:  {
project:  {
self: "https://jira.atlassian.com/rest/api/2/project/ANERDS",
id: "12510",
key: "ANERDS",
name: "Angry Nerds",
avatarUrls:  {
16x16: "https://jira.atlassian.com/secure/projectavatar?size=xsmall&pid=12510&avatarId=12492",
24x24: "https://jira.atlassian.com/secure/projectavatar?size=small&pid=12510&avatarId=12492",
32x32: "https://jira.atlassian.com/secure/projectavatar?size=medium&pid=12510&avatarId=12492",
48x48: "https://jira.atlassian.com/secure/projectavatar?pid=12510&avatarId=12492"
}
},
assignee:  {
self: "https://jira.atlassian.com/rest/api/2/user?username=anton%40atlassian.com",
name: "anton@atlassian.com",
emailAddress: "anton@atlassian.com",
avatarUrls:  {
16x16: "https://jira.atlassian.com/secure/useravatar?size=xsmall&ownerId=anton%40atlassian.com&avatarId=15399",
24x24: "https://jira.atlassian.com/secure/useravatar?size=small&ownerId=anton%40atlassian.com&avatarId=15399",
32x32: "https://jira.atlassian.com/secure/useravatar?size=medium&ownerId=anton%40atlassian.com&avatarId=15399",
48x48: "https://jira.atlassian.com/secure/useravatar?ownerId=anton%40atlassian.com&avatarId=15399"
},
displayName: "Anton Mazkovoi [Atlassian]",
active: true
}
}
},


Doing fields=project.key,assignee.emailAddress does not work either...

2 answers

1 accepted

6 votes
Answer accepted
Aleksander Mierzwicki _
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 19, 2013

The fileds param is a list of fields to expand in response. So the above response for fields=project,assignee is correct (you got those two fields expanded).

There is no way to get only project key and assignee email address in JIRA REST API (for issue search results).

Phillip Ponzer [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 17, 2017

For custom fields:

fields=customfield_12345
Like • Max Makhrov likes this
Max Makhrov
Contributor
November 1, 2018

Thank you, Aleksander! Is there a chance this feature to be included into API?

The problem is a user is forced to get tons of unnecessary info, and the goal is to get only needed info as fast as possible.

Like • 2 people like this
0 votes
Ade
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2019 edited

as per this comment, you can do this:

&fields=-creator

not to retrieve the creator object

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events