Project

General

Profile

Rest TimeEntries » History » Version 8

Дмитрий Непосидяка, 2019-02-03 15:20

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 8 Дмитрий Непосидяка
/time_entries.json?project_id=338&period_type=2&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
  * @issue_id@ or @project_id@ (only one is required): the issue id or project id to log time on
59
  * @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
64
+Response+:
65
66
  * @201 Created@: time entry was created
67
  * @422 Unprocessable Entity@: time entry was not created due to validation failures (response body contains the error messages)
68
69
h2. Updating a time entry
70
71
  PUT /time_entries/[id].xml
72
73
Updates the time entry of given id.
74
75
+Parameters+:
76
77
* @time_entry@ (required): a hash of the time entry attributes (same as above)
78
79
+Response+:
80
81
  * @200 OK@: time entry was updated
82
  * @422 Unprocessable Entity@: time entry was not updated due to validation failures (response body contains the error messages)
83
84
h2. Deleting a time entry
85
86
  DELETE /time_entries/[id].xml
87
88
Deletes the time entry of given id.