How to retrieve specific field using Jira Restful API


I am using Jira Restful API to get the issue status for a specific issue. the returned JSON object contains a full description if the status (Name, Icon, Description, ...).

How can I get only the StatusID to minimize the network traffic?

1 answer

1 accepted

You can use fields property in your GET request:

{JIRA INSTANCE ADDRESS}/rest/api/latest/issue/ISSUE-1?fields=status

where ISSUE-1 is key of the issue.  You will not get only status ID but something like:

{"status":{"self":"","description":"Issue is opened","iconUrl":"","name":"Open","id":"1","statusCategory":{"self":"","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}}}}

I guess response is small enough though :)



Thank you for your feedback. actually this is what I am doing now but it is not efficient if you have 


When you have too many results. So I was wondering how to get only the StatusID instead of StatusObject.

Thanks in advance,  

Jimmy, I don't think it is possible. The only possibility is to implement custom REST API with one endpoint or I found script runner allows you to implement simple REST API endpoints:

It will be the same since the bottleneck is getting data from Jira REST API, so if I implemented my own REST API on top of Jira API, it will be the same since I am still requesting all the information from Jira and ignore what I do not need at my side. it will be more efficient to get what I need only from Jira and not everything.

Do you have any other ideas? 

You've misunderstood what the REST endpoint in ScriptRunner does.  It allows you to write an endpoint that does what you need it to.  You could easily code an endpoint that responds only with the Status ID and nothing else when it is poked with an issue ID.

You don't do any work on your side and a handful of lines of code is going to be far more quick than Jira processing all the fields you ask for and sending back status object you don't want.

Thank you so much for your feedback!

I see you your point! So ScriptRunner is built on top of Jira and I will just use it. however in order for ScriptRunner to work, it has to either consume Jira REST API and truncate the not needed data on its side (in this case it will be useless) or it will have direct access to Jira Database to get only the required information (in this case I will have dependency on Jira Database version and ScriptRunner version).

I was hoping to find something already built in Jira REST API to support this as it does not make sense if I am getting 100 issues with two status, I receive the same object for all the 100 issues. I can just get the StatusID and do the mapping at my end.



Not quite, it's neither of those approaches.  ScriptRunner is an add-on that works within the core of Jira.  One of its functions is to provide REST end points.  You write code that uses the internal Java API to get the data you need when something pokes that REST endpoint. 

Your code is dependent on Jira and  ScriptRunner versions, but it's generally quite stable - the last time I had to rewrite my code was because of the significant refactoring Atlassian did between Jira 6 and 7.

It might make sense for your end point to accept a set of issue IDs and respond with something structured like "status 1, these X issues, status 2, these Y issues, etc".

I appreciate your feedback!

So Jira RET API has no built-in support for such filtration and I have to use additional add-on like ScriptRunner for that? the problem is installing add-on is not that easy at my company and a lot of approvals will be required.

No.  The REST API uses "fields=" as you saw earlier to filter down what fields it sends back for each issue.

The reason we've suggested Script Runner is because you want status IDs rather than status objects, and it might be quicker and easier for you to get groups of issues, rather than a flat list.  The built in REST API doesn't do either of those.

Thank you so much for your feedback! Appreciated!!

Thank you Nic, that's what I thought with script runner. Jimmy, you can always implement your own plugin to provide required functionality if it is easier to use in your company but it will require more effort to do it. So I think the script runner is still the easiest solution. 


Suggest an answer

Log in or Join to answer
Community showcase
Bridget Sauer
Published Mar 05, 2018 in Jira Software

Jack Graves: Real Ale enthusiast with a knack for Jira Software implementation

@Jack Graves first caught our eye with his incredible breakdown of what, in his opinion, can make or break a Jira software implementation. (Read his thoughts on this thread)! In this followup Sh...

65,960 views 4 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot