Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Recommended way to get my own worklogs through the REST API

Adrian Fahrbach October 24, 2023

I'm trying to get all of my worklogs with details through the JIRA API and I'm not quite sure if my approach is correct. It seems very counter intuitiv:

  1. Get all worklog ids using `/rest/api/3/worklog/updated`
  2. Send all of those ids to `/rest/api/3/worklog/list`
  3. Filter the result of the previous call by author

 

So my questions are:

  1. Do I really need to make two calls and filter them on my own or is there some kind of filter property hidden somewhere?
  2. Is there a way to sort `/rest/api/3/worklog/updated` to get the latest logs first or do I really have to loop through all pages until I reached the end?

1 answer

1 vote
Sunny Ape
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.
October 24, 2023

"Do I really need to make two calls and filter them on my own"

Yep

"Do I really have to loop through all pages until I reached the end?"

Yep

Welcome to the tedious world of pulling down Issue worklogs, returned in fixed chronological order :)

Use the startedAfter, startedBefore or since parameters in your queries to restrict the time range of the events to make your result set smaller, but you'll still have to deal with any pagination for large sets.

Have fun.

Adrian Fahrbach October 25, 2023

I actually found a "better" way to do it.

I'm searching for issues with JQL using the search endpoint and this query:

`worklogAuthor = %AUTHOR_ID% AND worklogDate > %DATE%`

With `"fields": ["worklog"]` it is possible to get the worklogs in the same call.

This leads to a loot of looping through paginations in there, but this way I usually have to use less calls and don't run in to issues on larger Jira instances.

Like Sunny Ape likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events