Forums

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

Jira REST API: How to obtain "timeSpent" of an issue for a specific sprint?

John Misc
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!
August 28, 2019

Using the endpoint:

GET /rest/agile/1.0/issue/{issueIdOrKey}

I can obtain the details of an issue, like the "timeSpent". However, if an issue spans across several sprints ( Sprint A, Sprint B, Sprint C ), the value of "timeSpent" will be the sum of all its time spent across the multiple sprints, but I only want to find the "timeSpent" for one specific sprint ( like Sprint B ).

How can I find the "timeSpent" of an issue for one specific sprint?

2 answers

1 accepted

1 vote
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 30, 2019

Hi John,

I understand that you are looking to find out an issue's time logged during a sprint.  However the timeSpent field in Jira is intentionally bound to the issue itself.  Hence, it is meant to measure the time logged on that issue over the life of that issue.

Instead of trying to use the timeSpent field, perhaps you use the worklog field instead.  You can call the REST API endpoint of GET /rest/api/2/issue/{issueIdOrKey}/worklog.  This will return all the worklog entries and their times.   The drawback of doing this is that you don't have an easy way to see which work log corresponds to a specific sprint.  You would need to compare the entry of that worklog against the known start/stop time of that sprint to see if it applies there or not.

I hope this helps.

Andy

John Misc
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!
September 2, 2019

Thanks for the advice. Seems like I will be solving it this way. :)

Nilupa Rupasinghe September 18, 2020

I have spent hours searching an answer for this problem. It seems this is the right approach. Thank you.

0 votes
Tom Hawkins
Contributor
October 5, 2021

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events