How to set the maxResults attribute in JIRA REST API?

In my Atlassian connect spring boot application, I am trying to retrieve data of issue types but it is giving only 50 results. After some research, I understand that this is because of the maxResults attribute. How to set that attribute wh

He @prathyusha.gali, what rest api url are you using? Also there is this endpoint to get all issue types as i can see, is that what you need in first place?

1 Like

My URL is something like this rest/api/2/search?jql=project=RPD1001 AND issuetype=BUG. Since the maxResult attribute is set to 50 by default, I cannot fetch more than 50 records. If I have 200 bugs, how to set the maxResults attribute to 200.

Ah, i see, you just add another parameter to your url like so rest/api/2/search?jql=project=RPD1001 AND issuetype=BUG&maxResults=amount_you_want

But be aware though that maxResults is limited to some value too, so for users for example it’s 1000 if i’m correct, and if you set maxResults to 1001 you will get onl 1000 anyway, so same logic applies to searching with jql (any maxResult is limited), but this limit ma varay from endpoint to endpoint, so you better get data and check if there is any left data to get by checking how much elements you got, hom much you requested and total of response in order to decide if you need to make another call.

You can read about that in pagination section of REST API docs

And another advise would be to urlencode your url’s if you don’t do it already.

Many thanks, but if at all, I use pagination I should make another API call right?

Well, ye :slight_smile:

For example you set maxResults to 100, you have 1000 issues that pass your jql search, and assuming your startAt is 0.

You get first 100, check if result of request has exactly as much as maxResults. Then if you need all other issues you make another call, for your second call you can set startAt to be maxResults and now check again if you get exactl maxResults, then make 3d call with startAt equals what it was before + another maxResults. Or you can also add variable to track how much issues you already got and check with total to see if you still need to make requests.
But tl;dr ye, you need to make separate calls to get all data, so just set maxResults to maximum and then get all data in few calls, though be aware the more calls you make the slower jira migh get while your add-on is making calls, that’s ofcourse applies to very big sets of data, but that’s a good thing to be aware of it

1 Like

Thank you very much Alexter! You are always giving a helping hand.:grinning:

1 Like

As I understand it, the limit is set to 50 immutably for Jira Cloud (Atlassian Connect). For Jira Server, the default limit is 1000, and an Administrator can adjust the limit by changing the application property

I need all the issuefields.I gave the jql query as project=EL and maxResults=150 ,but am getting as field maxResult does not exist.Is there any other way to get all the issues.

I’ve been off of plugin development for quite some time now. And this thread is quite old, so information might be outdated. But simple search in documentation shows me that the field is now called maxResulsts, even error you provided sugests that you might be using wrong field.

The only way to get more than 50 results in a view in Jira Cloud connect app is to check the first and based on that, (devide with 50) times to do an asynchronous request with an incremental offset of 50. Add result.issues after every request.

A bit cumbersome, but it works. Ofcourse for viewing purposes just stick to the pagination, but for export functions that may come in handy.