How to get filtered worklog via API?

Hi!

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 worklogs.total > 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 vote
Volodymyr Krupach Community Champion Feb 22, 2017

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 Join to answer
Community showcase
Emilee Spencer
Published Friday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

66 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot