How to get list of worklogs through JIRA REST API

Hi guys,

I need to get all worklogs for specific period of time. Now I see only one way:

  • Get all changed issues: rest/api/latest/search?jql=updated>=2012-09-01
  • Get every issue details: rest/api/latest/issue/ISSUE-KEY and extract worklogs from it.

Is there another way to get it? First that I tried was expand. I tried rest/api/latest/search?jql=updated>=2012-09-01&expand=worklog but it doesn't work. I'm trying to find a way to get everything with single query to avoid additional network colloboration. Could you advice anything please?

7 answers

FYI: Here's the PHP code for getting all worklogs within a specific period.

So, yes, you'll have to iterate through the potential batch of issues, but the key is to narrow down the results as much as possible. I did that by making sure that create date is before the end of the period, the update/modify date is after the beginning of the period, and that some time has been logged at all (timespent field). Then you simply get the full worklog for each item, and keep the entries within the period.

Quite quick on my setup with those constraints.


$server   = '';
$fromDate = '2012-01-01';
$toDate   = '2012-01-31';
$project  = 'X';
$assignee = 'bob';

$username = 'my_name';
$password = 'my_password';

$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);

# Give me up to 1000 search results with the Key, where
# assignee = $assignee  AND  project = $project
#  AND created < $toDate  AND  updated > $fromDate
#  AND timespent > 0
curl_setopt($curl, CURLOPT_URL, 

$issues = json_decode(curl_exec($curl), true);
foreach ($issues['issues'] as $issue) {
    $key = $issue['key'];
    # for each issue in result, give me the full worklog for that issue
    curl_setopt($curl, CURLOPT_URL,

    $worklog = json_decode(curl_exec($curl), true);
    foreach ($worklog['worklogs'] as $entry) {
        $shortDate = substr($entry['started'], 0, 10);
        # keep a worklog entry on $key item,
        # iff within the search time period
        if ($shortDate >= $fromDate && $shortDate <= $toDate)
            $periodLog[$key][] = $entry;
# Show Result:
#  echo json_encode($periodLog);
#  var_dump($periodLog);

Very nice, I made a small tool based on your snippet:

Will add additional features, filters and output types soon, but the basis is working to get your quick CSV output.

Yan O's solution will not work as Jira allows to log work in the past and the issue gets updated "now".

This solution also does not allow to check some period in the past, as it only scans issues LAST UPDATED in the given period. You would have to scan ALL the issues which is ridiculously slow.

And lastly, even with these bugs, the solution is terribly slow. I made a little script that pulls out all worklogs of the last week and it takes TWO MINUTES to run.

This situation is terrible and makes API pretty useless for us. Please, can you suggest or implement a usable solution?

PS: No, we can't access DB directly. Isn't the point of API to not need direct access to DB?

Hi Yan,

As an alternative to REST API, you can retrieve this information with this SQL query.

I hope this helps.


We cannot access the database directly. That is why there is API in the first place.


I know you are asking for a REST resource but you may be able to use Tempo's "getWorklogs" servlet that provides XML of the worklogs. See here for details:

Best regards,

-Bjarni (Tempo support)

Thanks for the tip Bjarni. I take the fact this servlet exists to be the proof that there is no way to get this basic information out of vanilla Jira. It is frustrating that Jira can do little to nothing without the use of plugins (mostly paid) because we are not in position to install (or even pay for) extensions. We will probably resort to running "hours long" scripts, stressing our already painfully slow Jira, to get simple reports from it (fail :-)

This is pretty common task which you typically want to do with the API as Jira GUI does not offer much to help with it. Yet, it is practically impossible.

More on that here:

I am looking into this problem for two days now and the only way to do this task seems to be to NOT USE API. The problem is that we can only use API or GUI.

Hello guys,

Please check my plugin Extender for JIRA and documentations Get Worklogs.

With my plugin you can now search worklogs for specific user, issue or JQL query using dedicated parameters like date, project kay etc.

Best regards
Adam Labus

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,119 views 4 9
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you