How to get more than 50 results from Jira rest API?

Shashank Agrawal January 8, 2020

Hi, I am trying to retrieve data using JIRA API (/jira/rest/agile/1.0/board) from Java. This API retrieves all the boards (scrum + kanban) in a json response as expected but the problem i am facing is it's only retrieving 50 results which is by default i believe.

Now how do i override this value and get more than 50 results? infact all the results.

I have tried to use maxResult attribute like /jira/rest/agile/1.0/board?maxResults=100 but no success. it still retrieves 50 results.

Can someone help on this. Any help is appreciated.

2 answers

0 votes
fbunting September 10, 2020

I was searching for this very question with the Confluence REST API, and came upon this question about Jira.  Although I don't know the Jira API, I discovered something through trial and error, that may be relevant to both Confluence and Jira.

There is a hard limit of 100 results, that is (as far as I know) undocumented.  You can lower the limit parameter (or maxResults in your case) to get fewer results, but setting it higher never gets you more than 100 results.  You have to use pagination to get more results ... keep repeating the search call, incrementing the start parameter by 100 each time.

Furthermore, this limit is reduced to 50 if you are requesting the body in your search results (using the expand parameter).

These hard limits may be configurable in Confluence or Jira, but I haven't explored that.

Hope that helps a little bit.

0 votes
Jorden Van Bogaert
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.
January 8, 2020

Hi @Shashank Agrawal 

This is a value that can be set in de advanced configuration for Jira. You should search for 'jira.search.views.default.max'.

It is possible however that your query works by setting maxResults to -1 but I'm not sure. Give it a go I'd say, and if that doesn't work, change the value as described above.

Kind regards
Jorden

Jorden Van Bogaert
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.
January 8, 2020

PS: You can find the property via

<JIRA BASE URL>/secure/admin/AdvancedApplicationProperties.jspa

Shashank Agrawal January 8, 2020

@Jorden Van Bogaert I don't want to change the property file and maxResults=-1 didn't work either.

Is there any other way to achieve this?

Jorden Van Bogaert
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.
January 8, 2020

Hi @Shashank Agrawal 

I'm afraid not :/ At least not that I know of...

Shashank Agrawal January 8, 2020

@Jorden Van Bogaert  So if we change the property file and say I modified the value to 500, will that affect the JIRA GUI as well? I mean will it display 500 results on the same page?

Please note I am retrieving the data using rest API's using Java and If i modify the property file with another value will that affect the Jira GUI as well in terms of displaying results?

Jorden Van Bogaert
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.
January 8, 2020

Hi @Shashank Agrawal 

It only impacts results for exporting so not the view in Jira. However, it may be better to adjust "jira.search.views.max.limit" and then use the maxResults parameter rather than changing the default value.

Kind regards

Jorden

Suggest an answer

Log in or Sign up to answer