[REST API] Retrieve Worklog Issue Edited

I have an issue/ticket with more than 20 worklogs (around 42 worklogs including the oldest one).

 

Now, I sent a request to retrieve those worklogs using GET method and this URL https://xxyyzz.atlassian.net/rest/api/2/issue/<issue>/worklog

 

All worklogs were retrieved but some description seem incorrect. Those description were all "time-tracking". It seems that JIRA has hidden or changed the correct value.

 

Question is how will I be able to retrieve the correct comments?

Is this an issue with JIRA REST API?

1 answer

1 accepted

0 votes
Accepted answer

Could you please post a screenshot?

Here's what a typical worklog looks like (sensitive information removed), and you should probably look for the 'comment'.

{
"self": "",
"author": {
"self": "",
"name": "",
"key": "",
"emailAddress": "",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "",
"active": true,
"timeZone": ""
},
"updateAuthor": {
"self": "",
"name": "",
"key": "",
"emailAddress": "",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "",
"active": true,
"timeZone": ""
},
"comment": "this is the worklog description you should be looking for",
"created": "",
"updated": "",
"started": "",
"timeSpent": "",
"timeSpentSeconds": 0,
"id": "",
"issueId": ""
}

Hope this helps.

Shaakunthala

{
"self": "",
"author": {
"self": "",
"name": "",
"key": "",
"accountId": "",
"emailAddress": "",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "",
"active": true,
"timeZone": ""
},
"updateAuthor": {
"self": "",
"name": "",
"key": "",
"accountId": "",
"emailAddress": "",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "",
"active": true,
"timeZone": ""
},
"comment": "This is the 20th worklog of this issue",
"created": ",
"updated": ",
"started": "",
"timeSpent": "",
"timeSpentSeconds": ,
"id": "",
"issueId": ""
},

--- OMITTED SOME WORKLOGS HERE ---

{
"self": "",
"author": {
"self": "https://xxyyzz.atlassian.net/rest/api/2/user?username=addon_is.origo.jira.tempo-plugin",
"name": "addon_is.origo.jira.tempo-plugin",
"key": "addon_is.origo.jira.tempo-plugin",
"accountId": "",
"emailAddress": "is.origo.jira.tempo-plugin@connect.atlassian.com",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "Timesheets",
"active": true,
"timeZone": ""
},
"updateAuthor": {
"self": "https://xxyyzz.atlassian.net/rest/api/2/user?username=addon_is.origo.jira.tempo-plugin",
"name": "addon_is.origo.jira.tempo-plugin",
"key": "addon_is.origo.jira.tempo-plugin",
"accountId": "",
"emailAddress": "is.origo.jira.tempo-plugin@connect.atlassian.com",
"avatarUrls": {
"48x48": "",
"24x24": "",
"16x16": "",
"32x32": ""
},
"displayName": "Timesheets",
"active": true,
"timeZone": ""
},
"comment": "time-tracking", // "This is the 42nd worklog of this issue" <-- this should be the comment
"created": "",
"updated": "",
"started": "",
"timeSpent": "",
"timeSpentSeconds": ,
"id": "",
"issueId": ""
}

Hi @Shaakunthala,

Please take a look at the example above.

In this example, the comments should be in this format:

This is the (worklog order) worklog of this issue

 

The 1st worklog (not shown above) and up to the 20th worklog, they displayed the correct comment.

However, starting from the 21st worklog (not shown above) and up to the 42nd worklog, they all showed 'time-tracking' as the comment which is not the right one.

 

Note: I didn't removed some information as it might be a factor to this issue.

Gotcha! "is.origo.jira.tempo-plugin"

This is new to me. Looks like you are using Tempo for time tracking. Do you see the correct comment in the JIRA user interface? In that case probably Tempo is storing worklog comment in the plugin data store. To drill down, we need to find the "AO_.*" table in the database that corresponds to Tempo.

However, that doesn't solve your problem.  Try installing JIRA Rest API Browser add-on and uncheck "Show only Public APIs". This might help you to find a REST API endpoint (if provided by Tempo) which is capable of retrieving the correct description/ comment.

Thanks,

Shaakunthala

As suspected, tempo is involved in this issue.

Try installing JIRA Rest API Browser add-on and uncheck "Show only Public APIs"

Is this a chrome extension/plugin? Please guide me how to do this.

Don't get misled by the 'browser' part in the add-on's name. ;)

It's a JIRA add-on: https://marketplace.atlassian.com/plugins/com.atlassian.labs.rest-api-browser/server/overview

Just noticed that you're using JIRA Cloud. This add-on isn't available for Cloud. So my recommendation is to set up your own trial JIRA instance with Tempo and do some research. (just to find a REST endpoint if available)

Once REST API Browser add-on is installed, go to http://test-instance-url/plugins/servlet/restbrowser#/ to access the API browser.

--

Shaakunthala

Thanks for the help @Shaakunthala

Anyways, I found something and it's a bit hassle way to retrieve the worklog's correct comment. I'll just leave it here in case someone encounters the same issue.

1) Send GET request with URL https://xxyyzz.atlassian.net/rest/api/2/issue/<issue key>/worklog/<worklog key>/properties/tempo

2) Retrieve tempo_id

3) Send another GET request with URL https://xxyyzz.atlassian.net/rest/tempo-timesheets/3/worklogs/<tempo_id>

4) Finally, retrieve the correct comment

 

P.S. Hopefully, JIRA team can create an endpoint to support this issue.

Appreciate posting your findings here. Definetely it's going to help someone. :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,354 views 14 19
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