Rest Groups » History » Version 5
Jean-Philippe Lang, 2012-06-03 15:32
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 | 4 | Jean-Philippe Lang | h3. GET |
63 | |||
64 | 5 | Jean-Philippe Lang | Returns details of a group. |
65 | 4 | Jean-Philippe Lang | |
66 | +Parameters+: |
||
67 | |||
68 | * @include@ (optional): a coma separated list of associations to include in the response: |
||
69 | 1 | Jean-Philippe Lang | |
70 | 5 | Jean-Philippe Lang | * @users@ |
71 | 4 | Jean-Philippe Lang | * @memberships@ |
72 | |||
73 | 1 | Jean-Philippe Lang | +Example+: |
74 | 4 | Jean-Philippe Lang | |
75 | 5 | Jean-Philippe Lang | GET /groups/20.xml?include=users |
76 | 4 | Jean-Philippe Lang | |
77 | +Response+: |
||
78 | |||
79 | <pre> |
||
80 | <group> |
||
81 | <id>20</id> |
||
82 | <name>Developers</name> |
||
83 | <users type="array"> |
||
84 | <user id="5" name="John Smith"/> |
||
85 | <user id="8" name="Dave Loper"/> |
||
86 | </users> |
||
87 | </group> |
||
88 | </pre> |
||
89 | |||
90 | 2 | Jean-Philippe Lang | h3. PUT |
91 | 1 | Jean-Philippe Lang | |
92 | 3 | Jean-Philippe Lang | Updates an existing group. |
93 | |||
94 | 2 | Jean-Philippe Lang | h3. DELETE |
95 | 1 | Jean-Philippe Lang | |
96 | 3 | Jean-Philippe Lang | Deletes an existing group. |
97 | |||
98 | 1 | Jean-Philippe Lang | h2. /groups/:id/users.:format |
99 | |||
100 | 2 | Jean-Philippe Lang | h3. POST |
101 | 1 | Jean-Philippe Lang | |
102 | 3 | Jean-Philippe Lang | Adds an existing user to a group. |
103 | |||
104 | +Parameters+: |
||
105 | |||
106 | * @user_id@ (required): id of the user to add to the group. |
||
107 | |||
108 | +Example+: |
||
109 | |||
110 | <pre> |
||
111 | POST /groups/10/users.xml |
||
112 | |||
113 | <user_id>5</user_id> |
||
114 | </pre> |
||
115 | |||
116 | +Response+: |
||
117 | |||
118 | * @200 OK@: user was added to the group |
||
119 | |||
120 | 1 | Jean-Philippe Lang | h2. /groups/:id/users/:user_id.:format |
121 | |||
122 | h3. DELETE |
||
123 | 3 | Jean-Philippe Lang | |
124 | Removes a user from a group. |
||
125 | |||
126 | +Example+: |
||
127 | |||
128 | <pre> |
||
129 | DELETE /groups/10/users/5.xml |
||
130 | </pre> |
||
131 | |||
132 | +Response+: |
||
133 | |||
134 | * @200 OK@: user was removed to the group |