Cloud API - access worklogs

How would i write an API query to get the total time logged in JIRA on issues this week for each user?

Just use /rest/api/2/search with some jql magic and then reduce the resulting array!

JQL magic:

  1. use worklogDate > 2017-1-07 to get issues for past week
  2. use timespent > 0 to get only issues which have time logged
  3. fields=worklog parameter to get the logging info

So you get the final query like

You need two more steps to get total time logged:

  1. map the results to get an array of all worklogs
  2. reduce the array to get the desired total time

I do javascript, so in JS it would look like this:

const worklogs = => result.field.worklog.worklogs).reduce((a,b) => a.concat(b) (1)

const totalTimeLogged = worklogs.reduce((value, worklog) => value += worklog.timeSpentSeconds, 0) (2)


is there a new way to do it now with the api 3?

could you please give some insight on how to use this API? I am very amateur in technical.

My requirement is, I want to generate report to track the time logged or efforts spent by each user in a sprint for a particular JIRA item. I am not able to use the “Time Spent” field as it only considers the consolidated efforts spent from the start of the JIRA task. The JIRA task can be spill over to the next sprint. But I want to understand the efforts logged by each user in a particular sprint or in a specific time frame. Hope I am clear in explaining.