Time Log / Time entries API for OpenProject
Logging time entries currently not available on API V3 docs ( http://docs.openproject.org/apiv3-doc ). So I have created a simple API that allows you to add a Log Time/time entry via this API.
-
npm install -
run
node app.js -
POSTtohttp://host:4000:-
Basic Auth(See http://docs.openproject.org/apiv3-doc/#header-authentication) :username:apikeypassword:<user_api_key>
-
Body parameters in
application/x-www-form-urlencodedproject_id:<project_id_id>Integeruser_id:<user_id>Integerwork_package_id:<work_packages_id>Integerhours:hours of spent: Floatcomments:comments max 250charsStringactivity_id:<enumerations_id>Integer (seeenumerationbelow)
-
-
Success indicate with status
200 -
Get
enumerationof time spent activity:GETtohttp://host:4000/enumwithBasic Authlike above- expected response:
[ { "id": 1, "name": "Management", "position": 1, "is_default": 1, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null }, { "id": 2, "name": "Specification", "position": 2, "is_default": 0, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null }, { "id": 3, "name": "Development", "position": 3, "is_default": 0, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null }, { "id": 4, "name": "Testing", "position": 4, "is_default": 0, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null }, { "id": 5, "name": "Support", "position": 5, "is_default": 0, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null }, { "id": 6, "name": "Other", "position": 6, "is_default": 0, "type": "TimeEntryActivity", "active": 1, "project_id": null, "parent_id": null } ] -
Customization
time_entries's design table
| Field | Type | Null | Key | Default | Extra |
|---|---|---|---|---|---|
| id | int(11) | NO | PRI | NULL | auto_increment |
| project_id | int(11) | NO | MUL | NULL | |
| user_id | int(11) | NO | MUL | NULL | |
| work_package_id | int(11) | YES | MUL | NULL | |
| hours | float | NO | NULL | ||
| comments | varchar(255) | YES | NULL | ||
| activity_id | int(11) | NO | MUL | NULL | |
| spent_on | date | NO | NULL | ||
| tyear | int(11) | NO | NULL | ||
| tmonth | int(11) | NO | NULL | ||
| tweek | int(11) | NO | NULL | ||
| created_on | datetime | NO | MUL | NULL | |
| updated_on | datetime | NO | NULL | ||
| overridden_costs | decimal(15,4) | YES | NULL | ||
| costs | decimal(15,4) | YES | NULL | ||
| rate_id | int(11) | YES | NULL |