Forums

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

New Work Logs Not Accessible Via API After Creation

Ladislav Prchal
Contributor
March 16, 2023

Hello,

I am trying to implement action-based script, that reacts on multiple actions in Jira. Whenever an action happens, webhook is fired with info to my app, where I do the rest of the action.

It works great for tickets (comments create/update, status update etc), however for work logs I have quite a problem.

Freshly created work logs are not accessible via API. At the same time, work logs which are there for some days are accessible without problem.

I could create my own "worklog" locally in my APP, however the data provided from webhook have Tempo Timesheet as the user.

How is this possible? Why work logs take so much time? How much time exactly? Is there a workaround? 

 

Used API URL with baerer token... It works fine for this one for example. Higher number brings "worklog not found or you dont have access". Even though the work log was just created and I literally get the API URL to supposed worklog.

https://api.tempo.io/tempo-timesheets/4/worklogs/330013

1 answer

1 vote
Susan Wu
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.
March 17, 2023

Hi @Ladislav Prchal ,

If you are using Jira API to get Jira worklogs, then the worklog author is showing Tempo Timesheets as intended behaviour as Tempo hosts our own Tempo worklogs in different from Jira instance. Please refer to this KB for more details.

If you are using Tempo API to get worklogs, you will get the actual username as worklog author. However, you need to make sure you have either "View all worklogs" permission for all the projects or "View worklogs" permission for all Tempo Teams to view all worklogs. Else. you will only be able to view your own worklogs through UI and API with your bear token

Hope this helps.

Best regards,

Susan Wu

Tempo Product Expert

Ladislav Prchal
Contributor
March 17, 2023

Thank you for your reply, at this moment I think I found out the problem.

 

From webhook I retrieve JiraWorklogId, not TempoWorkLogId. Which is little bit not expected, but I think I am going to be able to get over it and post the whole solution.

 

image.png

As you can see here, when I list all worklogs in given ticket, I can see that in fact I do not have tempo ID.

image.png

 

So I need to find relation in between jira worklog ID and tempo worklog ID. I hope that I can get ticket key. If I have it, then I can just list all worklogs and get what I need.

 

And with the tempo worklog ID, I retrieve real data without tempo timesheet. It is pain, but ... yeah, it is pain...

image.png

Susan Wu
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.
March 17, 2023

With Tempo API V3, you can see both jiraWorklogId and tempoWorklogId, but with Tempo API V4, you will only see tempoWorklogId. But you can still get jiraWorklogId with this endpoint on V4. 

https://apidocs.tempo.io/#tag/Worklogs/operation/getJiraWorklogIdsByTempoWorklogIds

Like # people like this
Ladislav Prchal
Contributor
March 18, 2023

Excellent, thank you very much, going to test it on Monday, but this looks like exactly what I need. Have a great day!

Like Dave Rosenlund _Trundl_ likes this
Ladislav Prchal
Contributor
March 20, 2023

Hello Susan Wu,

so I am looking at the endpoint you provided and unfortunatelly I need the literal opposite - I need Tempo WorkLog ID from Jira WorkLog ID :) I havent found such API there, however I found a solution I will implement meanwhile.

Sooo this might be solution as well.

01) From webhook you retrieve data such as:

"https://our.glorious.domain/rest/api/2/issue/41570/worklog/351507"

and of course info about created_date and such.

02) Using Issue ID, I require all work logs for the issue as: 

"https://api.tempo.io/4/worklogs/issue/41570" 

03) Last worklog there (with the same creation date as from the webhook) will be the one which I am looking for. This include the Tempo Worklog ID:

 image.png

04) And with Tempo Worklog ID I can get the details I needed:

https://api.tempo.io/tempo-timesheets/4/worklogs/332520 

 

 

I hope this will help someone.. I am of course open for adjustmens, if therre is better, direct method to get me this worklog, I will implement it gladly... But this time I need it to be operational and this is possibility :)

Like # people like this
Susan Wu
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.
March 20, 2023

Since Jira does not track Tempoworklogid, it's not possible to use Jira API to find Tempo worklogs. So you have to get the list of tempo worklog ids first and then back track to find the matching Jira worklog ids. But your solution works well as you can get the data needed.

Just a side note that in the option #4, you are using a private endpoint to get the details. So this endpoint is not documented and subject to change without advance notice. We would recommend you to use the public endpoint instead. 
https://api.tempo.io/4/worklogs/332520

Like # people like this
Ladislav Prchal
Contributor
March 20, 2023

Hello Susan Wu,

thank you very much for your imputs. It made my work much easier. I wish you the best for the future :) 

Like Dave Rosenlund _Trundl_ likes this

Suggest an answer

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

Atlassian Community Events