How to add a new entry of worklog in JIRA issue via REST API?

Hi everybody!
Could somebody give the cue how to add a new entry of worklog in JIRA’s issue via REST API?
I try to add worklog entry via REST API line:
curl --request POST -u user:password -H “Content-Type: application/json” “http://jiraserver:port/rest/api/2/issue/TESTERR-2/worklog?author=user&started=20180221&timeSpentSeconds=3600&adjustEstimate=new&newEstimate=2d”

Or in case I’ve already added a one worklog manually and would like to add a new one via REST API:
curl --request POST -u user:password -H “Content-Type: application/json” “http://jiraserver:port/rest/api/2/issue/TESTERR-2/worklog?author=user&started=20180221&timeSpentSeconds=3600”

  • TESTERR-2 - this is a JIRA issue key.

It doesn’t matter what parameter I added the text of error always the same:
{“errorMessages”:[“No content to map to Object due to end of input”]}

I use the REST API docs given here:

Do you have any idea how to do it?

Hi @aleksandr.karev - instead of using query parameters, try sending your worklog over in the POST body (use the -d option in curl):

-d '{"comment":"I did some work here.","started":"2018-02-21T00:00:00.000+0000","timeSpentSeconds":12000}'

Thank you! It works!

I used this on Linux:
curl -u username:password -H “Content-Type: application/json” -X POST “http://jiraserver:port/rest/api/2/issue/TESTERR-2/worklog” -d ‘{“comment”:“I did some work here.”,“started”:“2018-02-21T00:00:00.000+0000”,“timeSpentSeconds”:12000}’

And I used these options format in cURL on Windows:
curl -u user:password -H “Content-Type: application/json” -X POST “http://jiraserver:port/rest/api/2/issue/TESTERR-2/worklog” -d “{\“comment\”:\“I did some work here.\”,\“started\”:\“2018-02-21T00:00:00.000+0000\”,\“timeSpentSeconds\”:12000}”

Hi, Neil!
I made some investigations about this question and JIRA REST API in general and I expanded my theme in another question which closely related to this.

Could you help me to figure out with the new one?