It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can we get the last closed sprints in a project using JIRA Rest API? Edited

Hi team,

I am looking for getting the last closed sprint in a JIRA Cloud instance project using Rest API.

any one help us on this.

Thanks

Naveen 

2 answers

0 votes

Hello,

After some research it seems that there is no option for this out of the box.

The addon scriptrunner have a previous sprint function but only works in jira server.

0 votes
Andy Heinzer Atlassian Team Dec 17, 2019

Hi,

I understand you are looking for the last sprint closed in a project in Jira Cloud via the REST API.  There are a couple of problems that prevent this specific request.  First off: sprints are not bound specifically to a single project.  Sure you can set a sprint to only include issues from a single project, but the sprints have the ability to add any issues that could be included by the boards' filter.  Hence any given sprint could span several projects.  There is no clear way to only get back the last sprint that existed on a per project basis.

That said there is some information we could get from REST if we query the board itself, instead of the project.  First you need to know the board's ID number.  You can find this by visiting the board and looking at the URL for the rapidView number in the URL  OR you can look it up by first looking up all the boards that use the saved filter's id number.

Once you know the board id number, you can get all the sprints on that board with the endpoint GET /rest/agile/1.0/board/{boardId}/sprint.  There is not an endpoint to specifically retrieve the last sprint, so unfortunately, you would need to look at the state of each sprint on that board, and the endDate value and compare them against today's date/time.  This is one way you can determine via REST API results which sprint was closed last on that board.

I hope this helps.

Andy

Atleast an "order by" support on GET /rest/agile/1.0/board/{boardId}/sprint would have been a great favour.

Like difelicea likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you