Scooby
Scooby

Reputation: 3581

add worklog to JIRA (with user and activity metadata) using the API

I am using jira-python and request API to log work to JIRA tickets with the user and activity info but can't figure out a way to do it . I have the following code :

jira.add_worklog("issue number", timeSpent="2h", user="username")

but it seems to ignore the user keyword. I am also looking up JIRA API with request library but can't seem to find an API to log work with activity and user info.

Upvotes: 5

Views: 6443

Answers (2)

It is not needed to add inside the arguments the user. you can use the following code:

jira.add_worklog("issue number", timeSpent="2h")

Yo can add other arguments like:

  • adjustEstimate – (optional) allows the user to provide specific instructions to update the remaining time estimate of the issue. The value can either be new, leave, manual or auto (default).
  • newEstimate – the new value for the remaining estimate field. e.g. “2d”
  • reduceBy – the amount to reduce the remaining estimate by e.g. “2d”
  • started – Moment when the work is logged, if not specified will default to now
  • comment – optional worklog comment

You can find more info about it in jira python api

Upvotes: 4

Grisha Levit
Grisha Levit

Reputation: 8617

There's no direct support for this action, see this discussed in

https://answers.atlassian.com/questions/29951977

and

https://jira.atlassian.com/browse/JRA-30197

It's possible to impersonate another user, either by writing an add-on with the ACT_AS_USER scope or by registering your application with Oauth2 authentication in your Jira configuration, for example as discussed here:

https://answers.atlassian.com/questions/247528/how-do-you-impersonate-a-user-with-jira-oauth

You'd probably be better off discussing implantation suggestions on answers.atlassian.com.

Upvotes: 0

Related Questions