How to get filtered worklog via API?

Deleted user February 22, 2017

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 votes
Answer accepted
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 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 Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events