Rest TimeEntries » History » Version 11
florent thiery, 2021-01-07 09:48
1 | 5 | Konstantin Ladutenko | (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) |
---|---|---|---|
2 | |||
3 | 1 | Jean-Philippe Lang | h1. Time Entries |
4 | |||
5 | 4 | yuya ito | {{>toc}} |
6 | |||
7 | 1 | Jean-Philippe Lang | h2. Listing time entries |
8 | |||
9 | GET /time_entries.xml |
||
10 | |||
11 | Returns time entries. |
||
12 | |||
13 | 6 | Gaëtan Noël | +Parameters+: |
14 | |||
15 | * @offset@ |
||
16 | * @limit@ |
||
17 | * @user_id@ |
||
18 | 7 | Francesco Abeni | * @project_id@ |
19 | 6 | Gaëtan Noël | * @spent_on@ |
20 | * ... |
||
21 | |||
22 | 7 | Francesco Abeni | h3. @project_id@ filter |
23 | |||
24 | When filtering by project id, you can use either project numeric ID or its string identifier, e.g. |
||
25 | |||
26 | <pre> |
||
27 | ...&project_id=123 |
||
28 | </pre> |
||
29 | |||
30 | <pre> |
||
31 | ...&project_id=my-custom-project |
||
32 | </pre> |
||
33 | |||
34 | h3. @spent_on@ filter |
||
35 | |||
36 | When filtering by date, you can require a min / max date with a custom syntax: |
||
37 | |||
38 | <pre> |
||
39 | 9 | Aleksandar Pavic | /time_entries.json?project_id=338&from=2019-01-01&to=2019-01-03&limit=100 |
40 | 7 | Francesco Abeni | </pre> |
41 | 6 | Gaëtan Noël | |
42 | 1 | Jean-Philippe Lang | h2. Showing a time entry |
43 | |||
44 | GET /time_entries/[id].xml |
||
45 | |||
46 | Returns the time entry of given id. |
||
47 | |||
48 | h2. Creating a time entry |
||
49 | |||
50 | POST /time_entries.xml |
||
51 | |||
52 | Creates a time entry. |
||
53 | |||
54 | +Parameters+: |
||
55 | |||
56 | * @time_entry@ (required): a hash of the time entry attributes, including: |
||
57 | |||
58 | 11 | florent thiery | * @issue_id@ or @project_id@ (only one is required): the issue id or project id to log time on; note that project ids can only be found using the API (e.g. at /projects.json) |
59 | 1 | Jean-Philippe Lang | * @spent_on@: the date the time was spent (default to the current date) |
60 | * @hours@ (required): the number of spent hours |
||
61 | * @activity_id@: the id of the time activity. This parameter is required unless a default activity is defined in Redmine. |
||
62 | * @comments@: short description for the entry (255 characters max) |
||
63 | 10 | florent thiery | * @user_id@: user id to be specified in need of posting time on behalf of another user |
64 | 1 | Jean-Philippe Lang | |
65 | +Response+: |
||
66 | |||
67 | * @201 Created@: time entry was created |
||
68 | * @422 Unprocessable Entity@: time entry was not created due to validation failures (response body contains the error messages) |
||
69 | |||
70 | h2. Updating a time entry |
||
71 | |||
72 | PUT /time_entries/[id].xml |
||
73 | |||
74 | Updates the time entry of given id. |
||
75 | |||
76 | +Parameters+: |
||
77 | |||
78 | * @time_entry@ (required): a hash of the time entry attributes (same as above) |
||
79 | |||
80 | +Response+: |
||
81 | |||
82 | * @200 OK@: time entry was updated |
||
83 | * @422 Unprocessable Entity@: time entry was not updated due to validation failures (response body contains the error messages) |
||
84 | |||
85 | h2. Deleting a time entry |
||
86 | |||
87 | DELETE /time_entries/[id].xml |
||
88 | |||
89 | Deletes the time entry of given id. |