Jira API Add Worklog v2 and v3 have different requirements

Tomas Eychaner
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!
February 19, 2020

I've got a curl script that can add a worklog via the Jira API:

curl -u <MyUserName>:<MyAPIToken> -H "Content-Type: application/json" -X POST "<OurJiraInstanceUrl>/rest/api/2/issue/<IssueId>/worklog" -d "{\"comment\":\"Test\",\"started\":\"2020-02-19T09:00:00.000-0700\",\"timeSpent\":\"8h\"}

However, using v3 of the API with everything else exactly the same always results in:

{"errorMessages":["Invalid document format","Worklog must not be null."],"errors":{}}

Not sure what's so different, especially considering the documentation here and here appear to be the same...

Would somebody mind clarifying and/or updating the documentation for v3?

4 answers

2 votes
Urs Spycher
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!
January 3, 2021

From v2 to v3, the format of 'comment ' changed from a simple string to the more complex Atlassian Document Format (as documented in the API spec).

0 votes
Juan Cortes
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!
January 24, 2022

but the docs say "A comment about the worklog in Atlassian Document Format. Optional when creating or updating a worklog."

0 votes
Danny Scheelings
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 7, 2020

I don't understand the reply from @Niko Tzioras@Tomas Eychaner did you find out what the problem is? 

0 votes
Niko Tzioras
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!
March 24, 2020

Thank you, you saved my day! This must be a bug in the API...

Suggest an answer

Log in or Sign up to answer