Forums

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

Creating a worklog through JIRA REST API

Simo Nieminen January 23, 2019

Hi!

I've been trying to update my Jira issue with worklog through REST API. I have tried several solutions without success.

I.e.

jira.update(fields={"worklog":[{"add":{"timeSpent":"2h","started":"2019-01-23T21:00:01+02:00","comment":"x"}}]})

or

jira.update(fields={"worklog":{"timeSpent":"5m","started":"2019-01-23T21:00:01+02:00","comment":"x"}})

But all of them is giving an exception: "text: Field 'worklog' cannot be set. It is not on the appropriate screen, or unknown."

Thanks for your help in advance!

1 answer

1 accepted

0 votes
Answer accepted
Taranjeet Singh
Community Champion
January 23, 2019

@Simo Nieminen As the error suggests, you may be using the wrong field name or the field itself is not present on the Create, Edit and View screens of your JIRA project.

AS far as I remember, the field name should be "Log Work" that is to be added to project screens as well as used in your JIRA REST API request.

Simo Nieminen January 24, 2019

Thanks! I found the solution from here:

https://media.readthedocs.org/pdf/jira/stable/jira.pdf

So...

jira.add_worklog(issue, '5h', None, None, None, None, 'comment', None, None)

Suggest an answer

Log in or Sign up to answer