The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Is the add worklog API working as expected with 'author'?

Joe Teibel
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!
October 3, 2017

Hello, we are using the 'Cloud' version of Jira and I'm trying to add a worklog to a ticket programatically.  The issue I'm having is that I would like to use a "system account" to call the API and then associate the worklog with the user I specify in the request. As documented here  this appears to be supported by adding an "author" and "updateAuthor" object to the POST.  However, when I do that, the response I get consistently has the user that I authenticated against the API with as the "User" associated with the worklog as opposed to the one I specified in the request.

Here are the steps to reproduce what I'm trying to describe:

  1. Create request with user "bob" credentials.
  2. Call "add worklog" with an object like this:
{ comment: 'I did some work here.', started: '2017-09-29T09:00:00.000+0000', timeSpentSeconds: 7200, author: joe, updateAuthor: joe }

where 'joe' is a user object as specified in the doc like this (real account info replaced with fake values):

{ name: 'joe', key: 'joe', accountId: 'some-id', emailAddress: 'joe@email.com', avatarUrls: { '16x16': 'https://avatar-cdn.atlassian.com/', '24x24': 'https://avatar-cdn.atlassian.com/', '32x32': 'https://avatar-cdn.atlassian.com/', '48x48': 'https://avatar-cdn.atlassian.com/' }, displayName: 'Joe', active: true, timeZone: 'America/Los_Angeles' }

The API call succeeds but returns this (again, real account info replaced with fake values):

{ self: 'https://atlassian.net/rest/api/2/issue/59424/worklog/44955',  author:   { self: 'https://atlassian.net/rest/api/2/user?username=bob',      name: 'bob',     key: 'bob',     accountId: ‘bobs-account-id',     emailAddress: ‘bob@email.com',      ... },  updateAuthor:     { self: 'https://atlassian.net/rest/api/2/user?username=bob',     name: 'bob',     key: 'bob',     accountId: ‘bobs-account-id',     emailAddress: ‘bob@email.com',      ... },  comment: 'I did some work here.',  created: '2017-10-03T11:15:30.431-0600',  updated: '2017-10-03T11:15:30.431-0600',  started: '2017-09-29T03:00:00.000-0600',  timeSpent: '3h',  timeSpentSeconds: 10800,  id: '44955',  issueId: '59424' }

Note that the 'author' and 'updateAuthor' have both been returned as the user "Bob" instead of "Joe" which I posted in the request.

I've poked around the docs for quite a while trying to figure out what I may be doing wrong but I'm just not seeing it.  Can someone confirm that the API is working the way it should or let me know if this is an unreported bug?  Any help appreciated, thanks!

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2017

Hi Joe,

From JRASERVER-30197 and JRACLOUD-30197 it doesn't look like you're doing anything wrong.  Take a look at the Product Manager's response that I linked.

Please vote on JRASERVER-30197 and JRACLOUD-30197 to add your use case to the comments so we can add impact and get traction on this.

Cheers,

Branden

TAGS
AUG Leaders

Atlassian Community Events