Forums

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

How to retrieve all issues from a sprint/project

ataylor1 April 5, 2018

I am developing a cshtml mvc dashboard in Visual Studio to display current sprint progress but I am running into issues retrieving ALL of the issues that are in the sprint/project. I believe most of my issues come from my lack of understanding on how to properly use JQL or use the proper URL. For example, the only way I have been able to find the most recent sprint for a project is to use myCompany.atlassian.net/rest/greenhopper/1.0/integration/teamcalendars/sprint/list?jql=project+%3D+THU+and+Sprint+not+in+closedSprints() however I can't find documentation for this anywhere.

When I use this URL, I am able to get the most recent sprint ID to pass into myCompany.atlassian.net/rest/agile/1.0/sprint/sprintID/issue.json to get a list of all the issues inside of this specific sprint. However I only get returned 50 of the 73 total issues.

 

From searching around I see that my issue is related to a default max value of 50, but I am unable to find where I have to change that value on Jira Cloud. I can find documentation on Jira Server, but not Cloud. Does anyone know how to address this issue for Jira Cloud?

 

My other train of thought is a way around this would be to specifically search for issues that are Unclaimed, in Development, or in Code Review each individually but I do not know what URL address I need to type in to get those specific issues from the sprint. Does anyone know how to do this? If so I would love to see the documentation as well.

 

Thank you!

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2018

Jira Cloud has a known rate limit in regards to results from JQL queries.  I thought this was limited to 100 results per request currently, and not 50, but I suppose this could change at any given time.  Previously the maxResults value was set to 1000, however there were a significant number of queries that timed out, so much so that the performance of many sites were suffering as a result.

I'd recommend checking out Eve's status update on https://jira.atlassian.com/browse/JRACLOUD-67570

and in turn the documentation on Changing maxResults parameter for Jira Cloud REST API to get around this limitation.  I hope this helps.

ataylor1 April 6, 2018

Thank you for the response! However the biggest downfall to all of this documentation to me is that I have no idea of how the information is supposed to be formatted. For example, going off that second link you attached.. what is my URL supposed to look like following that example? Because any combination that I try that would make sense given that information just gives me a URL not found or no permission errors.

I also tried doing a JQL search that returned the information that I wanted (finally) however the data returned is not valid JSON and I cannot just simply append .JSON to the end because it throws an error. Why is this the case with some searches and not all? How am I able to get that to be valid information? The documentation just seems flawed and not in depth enough to answer these questions that I am having 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2018

I can see from your first post, that your URL is accessing a rest endpoint:

myCompany.atlassian.net/rest/greenhopper/1.0/integration/teamcalendars/sprint/list?jql=project+%3D+THU+and+Sprint+not+in+closedSprints()

In addition to accessing the Jira site in your browser, you can also use the REST API in order to obtain data from Jira.  I would recommend reviewing the Jira Software Cloud REST API documentation.   When you make a REST API call in Jira, the format is expected to be json.

Check out the section of that doc on 'Pagination', it explains how you can tweak the URL to use this startAt parameter:

http://host:port/context/rest/api-name/api-version/resource-name?startAt=0&maxResults=10

With this kind of alteration, you could then actually make two separate REST calls instead of one.  One of these would use the startAt=0 and the other with startAt=50 in order to gather all the results.   Between these two requests, you should then have all the results in json format.

georgiossalon
Contributor
November 22, 2018

Hallo Andrew,

 

so while using the Java Code from the Jira Documentation under:

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

to retrieve the issues, where am I supposed to implement the following

http://host:port/context/rest/api-name/api-version/resource-name?startAt=0&maxResults=10

in the 

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();

?

georgiossalon
Contributor
November 22, 2018

Found the answer!! :)

 

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

Suggest an answer

Log in or Sign up to answer