How to get filtered worklog via API?


I have an issue with getting worklog effectively.  

Earlier my team was using JIRA Server and plugin "Timesheet Reports and Gadgets for JIRA". This plugin has endpoint to get all timesheet in one request, which was brilliant. Now we are using JIRA Cloud and "Timesheet Reports and Gadgets for Cloud" plugin - and it doesn't have API endpoint. 

I've read in documentation, that the endpoint feature is not supported for now, and we should use JIRA API instead. I tried, but faced with great problem.

We have a few tickets with worklogs amount > 8000. That is expected, the way we work. Moreover, they are constant and "immortal", so worklogs amount increases every day. 

I am doing next:

Step 1.

GET /rest/api/2/searchjql=worklogDate>=param_date_1 
and worklogDate<=param_date_2 and worklogAuthor=param_user


In response, each ticket contains 20 worklogs.

These 20 worklogs are first 20 ticket worklogs, not filtered with given params, without possibility to fetch more, or to fetch last instead of first, or smth else. As far as I know, this is either expected behavior or known issue with low priority.

In our work such info is often not useful. So in case > 20, I do step 2: 


GET /rest/api/2/issue/{issueIdOrKey}/worklog

This way has drawbacks. First, it requires separate request per issue. Second, it doesn't have any filters - startAt, maxResult, by user or startedDate... According to docs, the only param is "expand", which won't help a lot. 

So in case of mentioned "immortal" tickets, this request returns thousands of  worklog records at once and is very heavy. Which is senseless, as usually we need the last 10-20 records, not all thousands. 

I tried also this endpoint: 

GET /rest/api/2/worklog/updated

But it also doesn't have any useful get params. If it had been possible to send issue Id or Key - it would have solved our troubles. 

I also searched for plugins, but didn't found a simple light plugin for REST timesheet functionality. Maybe I don't know what to look for. I cannot use SQL or something similar - we don't have admin rights and we won't have them. So the only way is REST.


Is there some workaround for this problem? 


Thanks in advance. 

1 answer

1 accepted

0 votes
Answer accepted

Hi Marry,

The approach you described is the only way to get worklogs through the REST API. I doubt you will find a cloud plugin with the REST timesheets point as cloud plugins actually rely on JIRA REST and there is no much sense to build custom REST upon JIRA REST API.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

391 views 6 0
Join discussion

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