Project

General

Profile

Rest Groups » History » Version 3

Jean-Philippe Lang, 2012-06-03 15:15

1 1 Jean-Philippe Lang
h1. Groups
2
3 2 Jean-Philippe Lang
{{>toc}}
4
5 1 Jean-Philippe Lang
h2. /groups.:format
6
7
h3. GET
8
9
Returns the list of groups.
10
11
+Example+:
12
13
  GET /groups.xml
14
15
+Response+:
16
17
<pre>
18
<groups type="array">
19
  <group>
20
    <id>53</id>
21
    <name>Managers</name>
22
  </group>
23
  <group>
24
    <id>55</id>
25
    <name>Developers</name>
26
  </group>
27
</groups>
28
</pre>
29
30
h3. POST
31
32
Creates a group.
33
34
+Parameters+:
35
36
* @group@ (required): a hash of the group attributes, including:
37
38
  * @name@ (required): the group name
39
  * @user_ids@: ids of the group users (an empty group is created if not provided)
40
41
+Example+:
42
43
<pre>
44
POST /groups.xml
45
46
<group>
47
  <name>Developers</name>
48
  <user_ids>
49
    <user_id>3</user_id>
50
    <user_id>5</user_id>
51
  </user_ids>
52
</group>
53
</pre>
54
55
+Response+:
56
57
  * @201 Created@: group was created
58
  * @422 Unprocessable Entity@: group was not created due to validation failures (response body contains the error messages)
59
60
h2. /groups/:id.:format
61
62 2 Jean-Philippe Lang
h3. PUT
63 1 Jean-Philippe Lang
64 3 Jean-Philippe Lang
Updates an existing group.
65
66 2 Jean-Philippe Lang
h3. DELETE
67 1 Jean-Philippe Lang
68 3 Jean-Philippe Lang
Deletes an existing group.
69
70 1 Jean-Philippe Lang
h2. /groups/:id/users.:format
71
72 2 Jean-Philippe Lang
h3. POST
73 1 Jean-Philippe Lang
74 3 Jean-Philippe Lang
Adds an existing user to a group.
75
76
+Parameters+:
77
78
* @user_id@ (required): id of the user to add to the group.
79
80
+Example+:
81
82
<pre>
83
POST /groups/10/users.xml
84
85
<user_id>5</user_id>
86
</pre>
87
88
+Response+:
89
90
* @200 OK@: user was added to the group
91
92 1 Jean-Philippe Lang
h2. /groups/:id/users/:user_id.:format
93
94
h3. DELETE
95 3 Jean-Philippe Lang
96
Removes a user from a group.
97
98
+Example+:
99
100
<pre>
101
DELETE /groups/10/users/5.xml
102
</pre>
103
104
+Response+:
105
106
* @200 OK@: user was removed to the group