Top Menu

Jump to content
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    Home
    • 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
    • Upgrade to Enterprise edition
    • 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?

      or sign in with your existing account

      OpenProject ID Google

Side Menu

Collapse project menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Expand project menu
General discussion
  1. OpenProject Community
  2. OpenProject
  3. Forums
  4. General discussion
  5. POST time entry form API

POST time entry form API

Added by Antonio Ettorre over 5 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...