Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get number of committed and achieved points in a sprint

krishna patamsetti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 20, 2021

I am trying to use JIRA API to get a few things.

1. Number of points committed in a sprint

2. Number of points achieved in a sprint.

I think for 2), it is fairly straightforward, and we're using sprint name to extract the issues in that sprint and calculating the sum of story points that are closed. But there is a problem with this approach. When we try to search for issues in a sprint - let's say Sprint 2, the API searches across Sprint 2, Sprint 20, 21... 24. Looks like the API is not taking the "=" into account. Here is a sample query - 

curl --globoff --request "POST" --header "Content-Type: application/json" --data "{
  "expand":
  [
    "names",
    "schema",
    "operations"
  ],
  "jql": "cf[12600]=\"core-eng\" AND cf[10100]=\"2021 Sprint 2\" AND labels=\"performance\"",
  "fields": [
    "summary",
    "status",
    "assignee",
    "customfield_10100",
    "customfield_12600",
    "customfield_11904",
    "customfield_10002",
    "labels"
  ]
}" --url "https://our.company.jira.com/rest/api/2/search"

This issue has been replicated by using the issue navigator as well. If we use the Sprint Id then we get the correct results. But, getting a Sprint ID is not so straightforward. because it only retrieves the first 50 sprint-ids. Is there an easy way to get the Sprint-Id by using the Sprint name? 

And for 1.) I've tried searching for a lot of JIRA APIs but looks like there is no API that provides the committed stories of a Sprint based on the sprint name or Id. Please let me know if there is any such API that I can use to get the committed points/stories during the start of the sprint.

2 answers

0 votes
Tom Rouillard
Contributor
September 6, 2024

Ok, I've been working my way through this same issue for some time now and reviewed numerous questions / answers on these boards. Here's what I found today while reviewing the console queries in Chrome when requesting the velocity chart for a specific board. I got to this answer from a comment on another question where this API was exposed, but the returned data was limited to the past 7 sprints. Instead, this one is limited to 120 sprints, which should be sufficient for most purposes.

The trick is to add a date range to the query and changing the "velocity" endpoint to "velocity.json".

When I ran the following API request through my Jira system in postman, I got back 18 sprints with sprint ids, start / end dates, commitment & completion points. 

https:://<your-jira-domain.com>/rest/greenhopper/1.0/rapid/charts/velocity.json?rapidViewId=10986&sprintsFinishedBefore=2024-09-07T04%3A59%3A59.999Z&sprintsFinishedAfter=2023-12-25T05%3A00%3A00.000Z

Run this in postman with your auth token and you will get back JSON with Sprint details in an array of sprints, like this ...

{
"sprints": [
{
"id": 12345,
"sequence": 12345,
"rapidViewId": 54321,
"name": "This is an Example Sprint Name",
"state": "CLOSED",
"goal": "",
"autoStartStop": false,
"synced": false,
"startDate": "21/Aug/24 9:20 AM",
"endDate": "04/Sep/24 9:20 AM",
"activatedDate": "21/Aug/24 2:12 PM",
"completeDate": "04/Sep/24 1:07 PM",
"canUpdateSprint": true,
"canStartStopSprint": true,
"canUpdateDates": true,
"remoteLinks": [],
"daysRemaining": 0
},
{ <more sprints> }
],
I'm not a fan of the date formatting in this response, but if this is the price to pay for getting all the data I need in a single call, I can manage reformatting the dates.
In the same JSON response, you will get velocity information that follows this format where estimated->value = your commitment and completed->value = what you finished (in points).
You'll have one velocity stat entry for every sprint entry in the list above. You'll need the sprint id from the first list to match with the velocity information in the second list. This is demonstrated below by the "12345" entry, which matches the sprint id in the example JSON above.
Also, note that the velocity stats do not come in as an array. Don't ask me why, I'm just delivering the news.
  "velocityStatEntries": {
"12345": {
"estimated": {
"value": 78.0,
"text": "78.0"
},
"completed": {
"value": 80.0,
"text": "80.0"
}
},
{ <more sprints> }
}
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2021

Hi @krishna patamsetti -- Welcome to the Atlassian Community!

I believe this one still works to get all sprints for a specific project:

myCompanyJiraUrl/rest/greenhopper/latest/integration/teamcalendars/sprint/list?jql=project=myProjectKey

And this one returns the sprint report for a specific board and sprint:

myCompanyJiraUrl/rest/greenhopper/1.0/rapid/charts/sprintreport?rapidViewId=myBoardId&sprintId=mySprintId

Please note: I believe the Greenhopper APIs are for internal use and have been deprecated.  Here are the current ones, so you may need to evolve your solution to use them and programmatically handle the searching issue you note: https://developer.atlassian.com/cloud/jira/software/rest/intro/

Kind regards,
Bill

Umesh Joshi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2024

Thanks this is great

Suggest an answer

Log in or Sign up to answer