Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Use jira api to calculate the sum of story points for all issues in a given active sprint Edited


I have a JQL filter to retrieve the list of jira issues for a given project for an active sprint. Each issue has a Story Points field that has story points numerical value for it.

I am looking for a way to use jira api to call this filter something like :-
This generates a JSON response with story point custom field appear as many number of times as there are issues in that filter. So lets say my story point field is customfield_10106 then i can see 14 occurenecs of this field since the filter returns 14 issues and for each occurence of customfield_10106 there is a value tied to it which is the numerical value of story points for that issue. so something like

"customfield_10106":3.0 // where 3 is the story points for that issue.

Is there a way to parse this json from the api and calculate the sume of story points for each occurence through a simple shell script ort directly use api to manipulate that.


Or is it better to use script runner to configure a scripted custom field that calculates the sum of the story points for a given jql filter and then pass that in rest api to display that total sum value?

Or are there other easy approaches to achieve this?


All we are looking for is to use jira rest api to get a response that gives us the sum of total story points for a given active sprint in a project.


Any help or suggestions here will be greatly appreciated as always.




2 answers

1 accepted

0 votes
Answer accepted
Daniel Ebers Community Leader May 24, 2021

Hi @ashleyg

the requirement is understood - basically it seems you want something like this visualization but gathered the data per API to use it in external tooling.

What you still could do to present a single custom field with one value that sums up all SP per sprint is to write back the gathered data from API to Jira.
When creating a custom field like "SP Sprint sum" you would need to likely daily update the value once a day (or so) in case SP are adjusted mid-sprint.

As for the specific implementation you could add the custom field to issues in your sprints, your sprint management is highly complex (involved in parallel sprints and the like) you could create a "meta" project in Jira holding data about your sprints including the new field for Sprint sums.

Of course, you could also look for a Script Runner solution but it seems you know how to handle REST API calls so it would be probably the easiest way.


Thanks Daniel! I do understand that fields are part of issue screens. So i believe what would make more sense is to have this field configured to the specific project but not show up in the issue screens not even view.

That way we can have automated script do a rest call to jira, get the sprint data, calculate the sum and then write back to jira for that custom field and then have the external tool use its rest call to fetch the sum from that custom field.

Please let me know if this should be ok or is my understanding incorrect?

Daniel Ebers Community Leader May 25, 2021

Yes, that makes sense. You only should test if the field can really be updated when not on screen - sometimes there is an error message using REST then telling that the "field is not on screen". Just give it a try - I think you're quite close to a good solution that works for your team.

Thanks Daniel!
I was able to workaround using the below bash/shell script approach  where customfield_10106 is the standard Story Points field and customfield_10811 is the custom field to store the sum of the story points for the filter that pertains to a specific project for any active sprint or sprints (in case of parallel sprints). Here, i store the sum of the story points under variable sum, then as you suggested have a separate restricted project SPS with a dedicated issue SPS-1 created with an edit screen where the customfield_10811 resides to dynamically update each time with the value stored under sum :-

sum=`curl -u user:password -X GET -H "Content-Type: application/json" "https://jira.***.com/rest/api/latest/search?jql=filter=***&fields=customfield_10106" | jq -r '[.issues[].fields.customfield_10106] | add'`

curl -u user:password -X PUT --data '{ "fields" : { "customfield_10811" : '$sum' } }' -H "Content-Type: application/json" "https://jira.***.com/rest/api/latest/issue/SPS-1"

curl -u user:password -X GET -H "Content-Type: application/json" "https://jira.***.com/rest/api/latest/issue/SPS-1" | jq -r '.fields.customfield_10811'

The idea is to run the first two curl periodically and then when needed just use the third curl to fetch the sum from that custom field (customfield_10811) by the tool rest api.

Hello @ashleyg 

The REST API can't do mathematical calculations, it can only return batches of information, such as all the issues you've searched for and the story points for each. It's up to you to do the mathematics within whatever programming language you're making the request with.

Read through the documentation of the language you're using to know how it parses the JSON and how to do summing of the values within.

Is there a way to have a custom field (may be scripted field from script runner) that calculates the sum of story points for all issues for a given filter and that way the rest api can simply return the response with that field name and its value?

Yes you could use ScriptRunner to sum all the Story Points from a selected group of Issues and put the results into a custom field, but fields apply per Issue, so the field would be associated with every issue of the same type. That's introducing a changing field value to potentially thousands of issues. Yikes! You're just shuffling the problem elsewhere and making it worse.

Essentially speaking, if the REST API has provided you with a data set, and that data set contains all the issues you're interested in and their Story Points, then you have everything you need. Use your script or program to iterate through the data set, sum up those story points to arrive at the total.

Thanks David!
The issue is that the tool only has rest implementation to fetch the data from jira and there is no way to manipulate anything in that tool.
Like the active sprint always displays in the backlog screen the total story points for it under To Do, In Progress and Done, would it not be simply easier to have somewhere store that data (sum of story points for a sprint) that can be easily called via rest and then all the tool needs to do is just collect that data.
If script runner doesn't allow this in an easy way, is there any other plugin that can help achieve this? I looked at Great Gadgets, etc and though they offer such a thing via gadgets on dashboards however, its still not something that is stored under some custom field or something that can be directly called by rest. 
I can easily use the rest call with that filter and specify the Story point field in the rest query url and then parse that and get the sum but like i said that the tool uses rest api to get data from jira and there is no way to manipulate that within the tool.

Sorry, but I can't give you any 'silver bullet' answer, since there are  many ways to solve the problem and many tools that do it in different ways

I wish you well in deciding which of the many different tools and methods will be the best to solve the problem in the manner described.

I don't have issue retrieving the sum value for the sum of story points for all issues in a given filter. Here is a one liner shell script that does that for me from a script perspective :-


sum=`curl -u user:password -X GET -H "Content-Type: application/json" "https://jira.***.com/rest/api/latest/search?jql=filter=12667&fields=customfield_10106" | jq -r '[.issues[].fields.customfield_10106] | add'`
echo $sum

Upon executing the above the value of sum is the exact sum of story points for all the issues of this filter.

However, the tool that i am talking about has integration with jira using rest implementation and i don't have any way to get into the tool and modify it in a way that it can allow me to do custom scripting to manipulate data.
All it does is to fetch the data from jira (jira fields) and display them. Likewise if it is possible to have a field itself in jira or something like that which can be called using jira rest and then display that then that would really help. 

Suggest an answer

Log in or Sign up to answer

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