Rest Groups » History » Version 5

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

1 1 Jean-Philippe Lang
h1. Groups
2 1 Jean-Philippe Lang
3 2 Jean-Philippe Lang
{{>toc}}
4 2 Jean-Philippe Lang
5 1 Jean-Philippe Lang
h2. /groups.:format
6 1 Jean-Philippe Lang
7 1 Jean-Philippe Lang
h3. GET
8 1 Jean-Philippe Lang
9 1 Jean-Philippe Lang
Returns the list of groups.
10 1 Jean-Philippe Lang
11 1 Jean-Philippe Lang
+Example+:
12 1 Jean-Philippe Lang
13 1 Jean-Philippe Lang
  GET /groups.xml
14 1 Jean-Philippe Lang
15 1 Jean-Philippe Lang
+Response+:
16 1 Jean-Philippe Lang
17 1 Jean-Philippe Lang
<pre>
18 1 Jean-Philippe Lang
<groups type="array">
19 1 Jean-Philippe Lang
  <group>
20 1 Jean-Philippe Lang
    <id>53</id>
21 1 Jean-Philippe Lang
    <name>Managers</name>
22 1 Jean-Philippe Lang
  </group>
23 1 Jean-Philippe Lang
  <group>
24 1 Jean-Philippe Lang
    <id>55</id>
25 1 Jean-Philippe Lang
    <name>Developers</name>
26 1 Jean-Philippe Lang
  </group>
27 1 Jean-Philippe Lang
</groups>
28 1 Jean-Philippe Lang
</pre>
29 1 Jean-Philippe Lang
30 1 Jean-Philippe Lang
h3. POST
31 1 Jean-Philippe Lang
32 1 Jean-Philippe Lang
Creates a group.
33 1 Jean-Philippe Lang
34 1 Jean-Philippe Lang
+Parameters+:
35 1 Jean-Philippe Lang
36 1 Jean-Philippe Lang
* @group@ (required): a hash of the group attributes, including:
37 1 Jean-Philippe Lang
38 1 Jean-Philippe Lang
  * @name@ (required): the group name
39 1 Jean-Philippe Lang
  * @user_ids@: ids of the group users (an empty group is created if not provided)
40 1 Jean-Philippe Lang
41 1 Jean-Philippe Lang
+Example+:
42 1 Jean-Philippe Lang
43 1 Jean-Philippe Lang
<pre>
44 1 Jean-Philippe Lang
POST /groups.xml
45 1 Jean-Philippe Lang
46 1 Jean-Philippe Lang
<group>
47 1 Jean-Philippe Lang
  <name>Developers</name>
48 1 Jean-Philippe Lang
  <user_ids>
49 1 Jean-Philippe Lang
    <user_id>3</user_id>
50 1 Jean-Philippe Lang
    <user_id>5</user_id>
51 1 Jean-Philippe Lang
  </user_ids>
52 1 Jean-Philippe Lang
</group>
53 1 Jean-Philippe Lang
</pre>
54 1 Jean-Philippe Lang
55 1 Jean-Philippe Lang
+Response+:
56 1 Jean-Philippe Lang
57 1 Jean-Philippe Lang
  * @201 Created@: group was created
58 1 Jean-Philippe Lang
  * @422 Unprocessable Entity@: group was not created due to validation failures (response body contains the error messages)
59 1 Jean-Philippe Lang
60 1 Jean-Philippe Lang
h2. /groups/:id.:format
61 1 Jean-Philippe Lang
62 4 Jean-Philippe Lang
h3. GET
63 4 Jean-Philippe Lang
64 5 Jean-Philippe Lang
Returns details of a group.
65 4 Jean-Philippe Lang
66 4 Jean-Philippe Lang
+Parameters+:
67 4 Jean-Philippe Lang
68 4 Jean-Philippe Lang
* @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 4 Jean-Philippe Lang
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 4 Jean-Philippe Lang
+Response+:
78 4 Jean-Philippe Lang
79 4 Jean-Philippe Lang
<pre>
80 4 Jean-Philippe Lang
<group>
81 4 Jean-Philippe Lang
  <id>20</id>
82 4 Jean-Philippe Lang
  <name>Developers</name>
83 4 Jean-Philippe Lang
  <users type="array">
84 4 Jean-Philippe Lang
    <user id="5" name="John Smith"/>
85 4 Jean-Philippe Lang
    <user id="8" name="Dave Loper"/>
86 4 Jean-Philippe Lang
  </users>
87 4 Jean-Philippe Lang
</group>
88 4 Jean-Philippe Lang
</pre>
89 4 Jean-Philippe Lang
90 2 Jean-Philippe Lang
h3. PUT
91 1 Jean-Philippe Lang
92 3 Jean-Philippe Lang
Updates an existing group.
93 3 Jean-Philippe Lang
94 2 Jean-Philippe Lang
h3. DELETE
95 1 Jean-Philippe Lang
96 3 Jean-Philippe Lang
Deletes an existing group.
97 3 Jean-Philippe Lang
98 1 Jean-Philippe Lang
h2. /groups/:id/users.:format
99 1 Jean-Philippe Lang
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 3 Jean-Philippe Lang
104 3 Jean-Philippe Lang
+Parameters+:
105 3 Jean-Philippe Lang
106 3 Jean-Philippe Lang
* @user_id@ (required): id of the user to add to the group.
107 3 Jean-Philippe Lang
108 3 Jean-Philippe Lang
+Example+:
109 3 Jean-Philippe Lang
110 3 Jean-Philippe Lang
<pre>
111 3 Jean-Philippe Lang
POST /groups/10/users.xml
112 3 Jean-Philippe Lang
113 3 Jean-Philippe Lang
<user_id>5</user_id>
114 3 Jean-Philippe Lang
</pre>
115 3 Jean-Philippe Lang
116 3 Jean-Philippe Lang
+Response+:
117 3 Jean-Philippe Lang
118 3 Jean-Philippe Lang
* @200 OK@: user was added to the group
119 3 Jean-Philippe Lang
120 1 Jean-Philippe Lang
h2. /groups/:id/users/:user_id.:format
121 1 Jean-Philippe Lang
122 1 Jean-Philippe Lang
h3. DELETE
123 3 Jean-Philippe Lang
124 3 Jean-Philippe Lang
Removes a user from a group.
125 3 Jean-Philippe Lang
126 3 Jean-Philippe Lang
+Example+:
127 3 Jean-Philippe Lang
128 3 Jean-Philippe Lang
<pre>
129 3 Jean-Philippe Lang
DELETE /groups/10/users/5.xml
130 3 Jean-Philippe Lang
</pre>
131 3 Jean-Philippe Lang
132 3 Jean-Philippe Lang
+Response+:
133 3 Jean-Philippe Lang
134 3 Jean-Philippe Lang
* @200 OK@: user was removed to the group