13
votes

I am using Jira REST API to get all the Issues in Jira for a specific Project. I don't want to have maxResults=50, which is the default. I just want to retrieve all issues for the project. Here is my command:

{ my $result = `curl -D- -u $usernameData:$passwordData -X GET -H "Content-Type: application/json" "http://jira.alm.mentorg.com:8080/rest/api/2/search?jql=project=HDS&maxResults=1000&fields=summary"`;}

I set maxResults=1000 and if I remove it, it will be set by default to 50! I just want to get all the Issues without having to worry about the maxResults. Can anyone help me with that?

4

4 Answers

12
votes
  1. Set the maxResults to a ridiculously high value e.g. 5000
  2. Make an extra call just to fetch the total records quickly, without actually fetching any content

    http://jira.alm.mentorg.com:8080/rest/api/2/search?jql=project=HDS&maxResults=0

5
votes

Yes, of course we can help. :D The answer is you cannot NOT worry about the maxResult field. There should however be another field in the return of the REST API that shows the total count. I don't remember what it was exactly but maybe total?

This is an API feature and you will have to manage it. 'pagination' is there to optimize data volumes and flow. Check the JIRA REST API Docs.

4
votes

I have just tried to pass -1 value to maxResults and got all the issues for the specific project. Not sure if this is a bug, which will be removed in next releases, but for now it works.. I am using JIRA v.6.2.2#6258 Call: /rest/api/2/search?jql=project=[project_ID]&fields=*none&maxResults=-1

So the next step would be to count returned array