Top Menu

Jump to content
Home
    • Projects
    • Activity
    • Work packages
    • Calendars
    • Team planners
    • Boards
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?
      Create a new account

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • Forums
  • Feature tour
    Feature tour
You are here:
  • Forums
  • General discussion

Content

POST time entry form API

Added by Antonio Ettorre over 3 years ago

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


Loading...