Open link in a new tab

Content

Expand project menu

POST time entry form API

Hi, 

i'm trying to POST using API a time entries for a task. I follow the guide: 

https://docs.openproject.org/api/time_entries/#time-entries-time-entry-create-form-post  and I use the example to do a POST using curl.

I don't have any errors from the terminal but no time entry is created and visible from web interface of task.

JSONFILE:

{

 "_links": {

   "activity": {

     "href": "/api/v3/time_entries/activities/5"

   },

   "workPackage": {

     "href": "/api/v3/work_packages/279"

   }

 },

 "hours": "PT1H30M",

 "comment": {

   "raw": "maintenance support"

 },

 "spentOn": "2020-04-14"

}

and using curl

curl -v -u apikey:$API_KEY -H "Content-Type: application/json" -d @$JSONFILE -X POST http://openproject.xxxx/api/v3/time_entries/form  | jq

the response if ended as the follow:

  "_links": {

   "self": {

     "href": "/api/v3/time_entries/form",

     "method": "post"

   },

   "validate": {

     "href": "/api/v3/time_entries/form",

     "method": "post"

   },

   "commit": {

     "href": "/api/v3/time_entries",

     "method": "post"

   }

Thanks