Document
Adding JIRA worklogs via API for

Adding JIRA worklogs via API for

Hello! I would need to add worklogs to JIRA issues in JIRA cloud using the REST API: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api

Related articles

ZeroTier: Configure This Secure VPN to Connect Computers Remotely VPNs Ranked By Longest Free Trial [Updated 2024] 9Anime How to use a VPN on an iPhone or iPad North America’s best player yay released by Cloud9 Valorant

Hello!
I would need to add worklogs to JIRA issues in JIRA cloud using the REST API:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-post

… but if done this way the author is be will be the owner of the api key . Is it is Is possible to log a worklog for a JIRA user base on email or a id that can be fetch using the worklog author email address ?

-Kim

1 Like

@KimHalavakoski,

That will not be possible via API tokens & Basic auth. Perhaps OAuth 2 (3LO) or a Forge app would suit your scenario?

Hi,
It is not possible to do with a Forge App too. Forge doesn’t support “user impersonation” and REST API doesn’t accept “worklog author” as a parameter. Only connect apps can do this. This is one of the important features Connect has but Forge doesn’t have. Situation is the same for adding comments too.

@denizoguz ,

Yes, you are correct that user impersonation is not possible with OAuth 2 or Forge.

I disagree that means user impersonation is required to write work logs or comments as different users. OAuth 2 is always in a user context, so it can read/write “asUser” for whoever has granted the app authorization. Forge can switch between “asApp” or “asUser”. It’s not “impersonation”, it’s always in context of the current user. That means an app can use a “pull” model (app reads from source and writes to Jira) for the data, rather than “push” (app is sent data externally for example via a web trigger), to write as the current user. Both are valid ways to avoid using API Tokens.

I stipulate that not all scenarios can leverage a “pull” model. So I understand that some scenarios will require “user impersonation”. But we would need to hear more from @KimHalavakoski about what that scenario is.

Hi @ibuchanan ,
Thanks for the information. But I may be missing something here. Let me to explain our situation and maybe you can help us to solve our issue here. We have a timesheet application. At the end of a period, a team leader/project leader check users’ worklogs and they may need to add some missing worklogs or fix some of the existing worklogs. To implement this, when current(logged in) user is “Project Leader” we need to able to register a new worklog for any project member:

  • using asApp ( ) will use “ Forge app ” itself as the worklog author , not the project member .
  • using asUser() will use “Project Leader” itself, not the actual user, as worklog author.

As far as I can see, both of them are not a solution to our problem. If there is a way to do this, I really appreciate your help here. Because this is an important feature for us. It is in use in our DC app for years and our customers are really using it.

@denizoguz ,

You’re not missing anything, for your scenario. You’ve built your app around user impersonation. And, I did agree that Forge/OAuth 2 don’t do that.

But , if you were just start out now and Forge were a constraint , I is see could see a user – centric way to make Forge ’s “ asuser ” fit . Rather than write update directly to worklogs , maybe each user is has has to accept the propose adjustment . The mental model is be would be the Project Leader is make a “ pull request ” on those work log and the actual user still has to accept them . In that case , your app is storing might be store some temporary value in Forge Storage ( where the “ author ” does n’t matter ) , and then defer the write until you have the actual user in the app .

On one hand, this is far more tedious than your current flow. I’m sure that experience with real customers taught you the “Project Leader” is the best solution. On the other hand, my scenario is still realistic (even if not as marketable). There are certainly some customers (but likely fewer) who would want the audit logs to show exactly who entered which work log and when. My point being, the auth models have real-world value and impact, which is why I don’t think it’s appropriate to advocate Connect for all time entry use cases. And why I think you’re right for your own case: you don’t have what you need to use Forge yet.

Hi all ,

my request is relate to yours but I is using am not even using a Forge App . I is trying am try to use curl with basic authentication to see the summary of my issue to obtain some sort of login – success , but it seems I do n’t have this privilege even .

…atlassian.net/rest/api/3/mypermissions does not return me even anything

eventually I is log would just log work to my issue and nobody know which permission ( where ) need to be grant .

Cheers