JIRA REST API - how do I get results from a filter?

Hi

A GET on rest/api/2/search?jql=filter=123 gets me some info but not the actual results. How do I go about getting the actual results?

2 answers

1 accepted

3 votes
Timothy Chin Community Champion Jan 26, 2014

Your usage of the REST endpoint is wrong. If you have a filter ID, you use this REST endpoint:

https://docs.atlassian.com/jira/REST/latest/#d2e308

This gives you:

 "searchUrl": "http://www.example.com/jira/rest/api/2/search?jql=type%20%3D%20Bug%20and%20resolutino%20is%20empty", 
which you use again get the issues.

Thank you that works!

I think what was being asked here, was how would someone execute a filter so that they don't need to manage the query manually. I too would like to know this.

yes and Timothy answer provides solution, read it again ...

Could you go into a little more detail on this- how can you use the searchUrl from one rest endpoint, to set up another request? Are these all going in the args section of the template function? 

I posted a similar follow up question here: https://answers.atlassian.com/questions/41462677

To clarify the solution above, you are using the filter GET API in order to fetch the definition of the filter as a search url (with embedded JQL), then using that url to fetch the actual filter results from the search API. So your choice is to either embed a filter id in your code, or a JQL statement. If the former, you can at least manage the JQL query within JIRA's interface, and have your code fetch the latest definition of that filter before querying the search API for results.

Your usage of the REST endpoint is wrong. If you have a filter ID, you use this REST endpoint:

https://docs.atlassian.com/jira/REST/latest/#d2e308

This gives you:

 "searchUrl": "http://www.example.com/jira/rest/api/2/search?jql=type%20%3D%20Bug%20and%20resolutino%20is%20empty", 
which you use again get the issues.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,120 views 13 19
Join discussion

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