Update the worklog author from the REST API

Alexander Eck [Tempo]
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 2, 2020

Hi dear all,

I am trying to update the worklog author of a worklog through the REST API on Jira Cloud. I am using this endpoint documented here. Means I call the endpoint: 
https://myatlassianurl.atlassian.net//rest/api/3/issue/10027/worklog/10016

I tried to send the payload as:

{ "author": {"accountId": "myAtlassianAccountID"}

without any success. I get a positive response and i see myself as the "updatedauthor" but the passed "worklogauthor" gets ignored. I tried also the "properties" section with:

{
"properties":
[{"author":
{"key":"accountId",
"value": "myAtlassianAccountID"}
}]
}

but this throws an error:

{    "errorMessages": [        "N/A (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.WorklogJsonBean[\"properties\"])"    ]}

Any hint is much appreciated.

 

3 answers

1 vote
Eciruam Divad
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2020

Hi,

I can do that by using the Addon WorklogPro (WEB or REST API): log et edit for another, and so it can change the worklog Author and UpdateAuthor. 

But I can't understand why it is not possible with a specific permission in User permission without buying then worklogPro. 

Juste to have this basic capability you need to buy the worklogPro :-(

Regards,

M David

Alexander Eck [Tempo]
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.
August 21, 2020

Thanks for coming back. My best guess is that the add-on is doing something in the background that we are not aware of. E.g. deleting the worklog and creating a new one. But I agree it would be great to get an answer from the WorklogPro Team on this.

BR

Like Eciruam Divad likes this
0 votes
Alexander Eck [Tempo]
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 5, 2020

I am aware that deleting and creating the worklog is an option but does not help me in solving my problem.

I would really like to see how a well formatted JSON body would look like to be sent with "properties". If the REST call would accept my payload I guess I will get another error message (if the worklog author can´t be updated). So any help to provide me with a valid payload would be much appreciated.

Thanks

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2020

Hi Alexander,

I understand that you want to use the REST API in Jira Cloud to change the details of which user logged work on an issue.   However I do not believe this is technically possible to do in Jira, either via REST or via the web console and I will try to explain why.

Even as a Site admin in Jira Service Cloud, you can't actually change the user that created the worklog.  You can edit the comments, timespent. date started, and remaining estimate in the web interface, OR you could delete the worklog entirely.  You can also do that in REST.  Both of these methods require you have the necessary project permissions to do so. 

But neither method actually supports you changing the author of the worklog itself.  There is an open feature request for admins to be able to expressly log work as another user over in JRACLOUD-30197.  I believe that the updateAuthor is actually in reference to the user that edited the worklog.  However changing the author field of a worklog is not supported here.

I did come across another post on this topic over in https://community.atlassian.com/t5/Jira-questions/Edit-worklogs-author/qaq-p/1134809

In it @Thomas Deiler has an interesting workaround where he suggests you could get all the entries of a worklog author via REST, add them back under the desired account, and then delete the old entries.  I know that might not be a glamorous work-around, but I believe it will have the desired results in the end at least.

I hope this helps.

Andy

Suggest an answer

Log in or Sign up to answer