Project

General

Profile

Rest TimeEntries » History » Revision 13

Revision 12 (florent thiery, 2021-01-07 09:48) → Revision 13/15 (florent thiery, 2021-01-07 09:49)

(note: for some versions of Redmine you can need some other extension of path /time_entries.xml, e.g. 2.5 works with *.json http://www.redmine.org/boards/2/topics/48933?r=48934#message-48934 , sometimes in plugins it comes simply without any extension) 

 h1. Time Entries 

 {{>toc}} 

 h2. Listing time entries 

   GET /time_entries.xml 

 Returns time entries. 

 +Parameters+: 

 * @offset@ 
 * @limit@ 
 * @user_id@ 
 * @project_id@ 
 * @spent_on@ 
 * ... 

 h3. @project_id@ filter 

 When filtering by project id, you can use either project numeric ID or its string identifier, e.g. 

 <pre> 
 ...&project_id=123 
 </pre> 

 <pre> 
 ...&project_id=my-custom-project 
 </pre> 

 h3. @spent_on@ filter 

 When filtering by date, you can require a min / max date with a custom syntax: 

 <pre> 
 /time_entries.json?project_id=338&from=2019-01-01&to=2019-01-03&limit=100  
 </pre> 

 h2. Showing a time entry 

   GET /time_entries/[id].xml 

 Returns the time entry of given id. 

 h2. Creating a time entry 

   POST /time_entries.xml 

 Creates a time entry. 

 +Parameters+: 

 * @time_entry@ (required): a hash of the time entry attributes, including: 

   * @issue_id@ or @project_id@ (only one is required): the issue id or project id to log time on (both are integers); note that project ids can only be found using the API (e.g. at /projects.json) 
   * @spent_on@: the date the time was spent (default to the current date); format is e.g. 2020-12-24 date) 
   * @hours@ (required): the number of spent hours 
   * @activity_id@: the id of the time activity. This parameter is required unless a default activity is defined in Redmine. 
   * @comments@: short description for the entry (255 characters max) 
   * @user_id@: user id to be specified in need of posting time on behalf of another user 

 +Response+: 

   * @201 Created@: time entry was created 
   * @422 Unprocessable Entity@: time entry was not created due to validation failures (response body contains the error messages) 

 h2. Updating a time entry 

   PUT /time_entries/[id].xml 

 Updates the time entry of given id. 

 +Parameters+: 

 * @time_entry@ (required): a hash of the time entry attributes (same as above) 

 +Response+: 

   * @200 OK@: time entry was updated 
   * @422 Unprocessable Entity@: time entry was not updated due to validation failures (response body contains the error messages) 

 h2. Deleting a time entry 

   DELETE /time_entries/[id].xml 

 Deletes the time entry of given id.