Forums

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

How to retrieve ordered filter results through REST API?

Thorsten Twellmann
Contributor
October 2, 2018

Hi,

I want to retrieve the result of a saved filter through the REST API using /jira/rest/api/2/search. The filter definition contains an ordering by resolutiondate (I test also id). If I change the direction from ASC to DESC the order changes in the Jira UI but not in the json object returned by the REST call. Why? How can I retrieve an ordered result through REST?

Thanks!

Tuelle

2 answers

0 votes
Thorsten Twellmann
Contributor
October 2, 2018

Thanks for the tip, but this does not change the behavior.

Rambabu Patina _Appfire_
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.
October 2, 2018

Did you tried something like:

/rest/api/2/search?jql=project=TEST and status=closed&orderBy=-resolutiondate

If it does not work for you please post the rest call what exactly you were trying.

Rambabu Patina _Appfire_
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.
October 2, 2018

As a workaround you can use:

/rest/api/2/search?jql=project = TEST and resolution is not empty ORDER BY resolutiondate ASC&orderBy=-resolutiondate

Please try it and let me know. 

0 votes
Rambabu Patina _Appfire_
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.
October 2, 2018

 @Thorsten Twellmann, Can you try adding the extra query parameter to your REST call which you want to order by as like below:

?orderBy=-resolutiondate

To order by "resolutiondate" descending

Hope this helps you. Thanks.

Suggest an answer

Log in or Sign up to answer