How to get IssueId based on WorklogId ?

Frédéric Le Goux December 2, 2020

I am trying to extract worklogs from Jira to upload them in our timesheet app.

To do so, I'd like to use the endpoint Get IDs of updated worklogs in order to retrieve worklogs that were updated since last extraction.

 

My problem is that in the returned JSON:

  • I neither can expand properties to get worklogs details directly
https://<MyJiraCloud>.atlassian.net/rest/api/3/worklog/updated?expand=<???????????>
  • nor get any IssueId in the JSON returned
{"values":
[{"worklogId":10100,"updatedTime":3714749016604,"properties":[]},
{"worklogId":10101,"updatedTime":8914749138088,"properties":[]},
{"worklogId":10102,"updatedTime":5414767934810,"properties":[]}

 

So i am stuck here! I have the list of recently updated worklogs but i can't use them as requesting worklog details implies to know what is the related issue.

See Get worklog definition where "IssueIdOrKey" is mandatory:

GET /rest/api/3/issue/{issueIdOrKey}/worklog/{id}

 

Does anyone has allready encountered this problem and/or has a solution to it? Many thanks!

1 answer

1 accepted

0 votes
Answer accepted
mogavenasan
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.
January 3, 2021

Hi @Frédéric Le Goux ,

There are 2 different ways you can go about this:

  1. Find the worklogs for a specific issue:
    1. Let's say you already have the list of recently updated issues and filtered the list to the recently updated component is worklogs.
    2. From there, you can iterate the issue list to obtain the worklogs for each issue.
  2. Use the same API from Get IDs of updated worklogs:
    1. Not sure if the expand param works, you can try expand=all.
    2. If no luck for the above, then you can use Get Worklogs and use the IDs from the Get IDs of updated worklogs.

I hope that this helps.

Thanks,
Moga

Frédéric Le Goux January 4, 2021

Thank you for the answer @mogavenasan !

 

The second solution you came up with was the best one for me, but I would have preferred not to manage arrays and split the list every 1000 work logs.

For information, expand all return the same fields, i.e. it seems there is only 3 fields returned.

Like mogavenasan likes this
mogavenasan
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.
January 4, 2021

Hey @Frédéric Le Goux,

That's the closest what I can find from the available REST API endpoint.

Glad to know that I can help! :)

Suggest an answer

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

Atlassian Community Events