This is literally what I'm sending:
{"timeSpent":"5m","started":"2013-12-08T21:00:01+01:00","comment":"x"}
to issue/KEY/worklog in a POST request.
The response is always 500, with "Internal server error" as error message. Not very useful.
The literal response:
{"errorMessages":["Internal server error"],"errors":{}}
If I try another combination of fields, I get an error 400, which makes sense, because it's a wrong combination of fields. The above should work though.
I'm using OnDemand. I don't have any worklog plugins enabled, just the normal stuff that works in the UI. Most of the API works perfectly.
I would think, whatever the error, the reponse should be more descriptive than a 500, which sounds like it's not my fault. But then what is it?
If I use PUT issue/KEY (with update.worklog) as method to log work, the request is, literally:
{"update":{"worklog":[{"add":{"timeSpent":"5m","started":"2013-12-08T21:00:01+01:00","comment":"x"}}]}}
and the response is a 400 with error message:
"Field 'worklog' cannot be set. It is not on the appropriate screen, or unknown."
Might that be why the first request fails too? I don't want to add the worklog widgets to the resolve and edit screens. Logging work is a separate thing and it does work separately via the UI.
:
Community moderators have prevented the ability to post new answers.
Ran a quick test and got 500 error like you mentioned. I then examined the data and changed it to this:
{"timeSpent":"5m","started":"2013-12-08T21:00:01.000+0100","comment":"x"}
This seemed to work find. Aka, changed the last portion of your time format from "01+01:00" to "01.000+0100".
You should really get a 400 reponse for invalid input instead of a 500.
ah looks like the invalid response was already reported: https://jira.atlassian.com/browse/JRA-31460
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes! That does it.
I used ISO 8601 to represent datetime (which is a preset in PHP), but Jira always uses the other. I could've spotted that... Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm having problems as well...slightly different, but posted here in case you have any ideas (I've implemented your 'Date' fix as suggested above). https://answers.atlassian.com/questions/10407898/httpclient-c%23-to-create-work-log-always-returns-500-internal-server-error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ran into the same problem again in 2019.
This time I get a long system stack:
https://community.atlassian.com/t5/Jira-questions/REST-POST-worklog-on-issue-fails-with-500/qaq-p/904382
@David Chan can this be connected?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.