How to get Issues > maxResults=50 from a Board with Java?

georgiossalon
Contributor
November 22, 2018

My task is to get all the Issues from the Backlog of a Board.

 

So I have seen a similar Post at:

https://community.atlassian.com/t5/Jira-questions/How-to-get-more-than-50-issues-with-search-API/qaq-p/463122

 

, but unfortunatelly this doesn't answer my question.

 

At the Jira Website concerning the REST API:

https://developer.atlassian.com/cloud/jira/software/rest/#api-rest-agile-1-0-board-boardId-backlog-get

 

I found the following Java Code which works:

// This code sample uses the  'Unirest' library:
// http://unirest.io/java.html
HttpResponse response = Unirest.get("https://your-domain.atlassian.net/rest/agile/1.0/board/{boardId}/backlog")
  .basicAuth("email@example.com", "")
  .header("Accept", "application/json")
  .asJson();

System.out.println(response.getBody());

The Problem is, that it only gives 50 Issues, as the maxResults is automatically set to 50.

 

How can I alter the "maxResults" parameter to get all the Issues using "Unirest"? 

 

I have already tried using ->> ...

rest/agile/1.0/board/{boardId}/backlog;&ampmaxResults=50000

 which doesnt work.

1 answer

0 votes
georgiossalon
Contributor
November 22, 2018

Found partially an answer for Issues till 1000.

I had only to do the following:

HttpResponse response = Unirest.get("https://your-domain.atlassian.net/rest/agile/1.0/board/{boardId}/backlog?startAt=0&maxResults=1000")
  .basicAuth("email@example.com", "")
  .header("Accept", "application/json")
  .asJson();

so just add after backlog this: 

?startAt=0&maxResults=1000

with 0 and 1000 being just integer variables. 

 

*Edit*

Note that it will not get more Issues then 1000. So if I'try 10000 it will still set "maxResults" to 1000. So I still did not find an answer for >1000 Issues.

Suggest an answer

Log in or Sign up to answer