Rest Groups » History » Version 7

Matt Wiseley, 2014-11-13 20:51
changed incorrect "users_ids" json parameter to "user_ids"

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 6 Jean-Baptiste Barth
<pre>
56 6 Jean-Baptiste Barth
POST /groups.json
57 6 Jean-Baptiste Barth
58 6 Jean-Baptiste Barth
{
59 6 Jean-Baptiste Barth
  "group": {
60 6 Jean-Baptiste Barth
    "name": "Developers",
61 7 Matt Wiseley
    "user_ids": [ 3, 5 ]
62 6 Jean-Baptiste Barth
  }
63 6 Jean-Baptiste Barth
}
64 6 Jean-Baptiste Barth
</pre>
65 6 Jean-Baptiste Barth
66 1 Jean-Philippe Lang
+Response+:
67 1 Jean-Philippe Lang
68 1 Jean-Philippe Lang
  * @201 Created@: group was created
69 1 Jean-Philippe Lang
  * @422 Unprocessable Entity@: group was not created due to validation failures (response body contains the error messages)
70 1 Jean-Philippe Lang
71 1 Jean-Philippe Lang
h2. /groups/:id.:format
72 1 Jean-Philippe Lang
73 4 Jean-Philippe Lang
h3. GET
74 4 Jean-Philippe Lang
75 5 Jean-Philippe Lang
Returns details of a group.
76 4 Jean-Philippe Lang
77 4 Jean-Philippe Lang
+Parameters+:
78 4 Jean-Philippe Lang
79 4 Jean-Philippe Lang
* @include@ (optional): a coma separated list of associations to include in the response:
80 1 Jean-Philippe Lang
81 5 Jean-Philippe Lang
  * @users@
82 4 Jean-Philippe Lang
  * @memberships@
83 4 Jean-Philippe Lang
84 1 Jean-Philippe Lang
+Example+:
85 4 Jean-Philippe Lang
86 5 Jean-Philippe Lang
  GET /groups/20.xml?include=users
87 4 Jean-Philippe Lang
88 4 Jean-Philippe Lang
+Response+:
89 4 Jean-Philippe Lang
90 4 Jean-Philippe Lang
<pre>
91 4 Jean-Philippe Lang
<group>
92 4 Jean-Philippe Lang
  <id>20</id>
93 4 Jean-Philippe Lang
  <name>Developers</name>
94 4 Jean-Philippe Lang
  <users type="array">
95 4 Jean-Philippe Lang
    <user id="5" name="John Smith"/>
96 4 Jean-Philippe Lang
    <user id="8" name="Dave Loper"/>
97 4 Jean-Philippe Lang
  </users>
98 4 Jean-Philippe Lang
</group>
99 4 Jean-Philippe Lang
</pre>
100 4 Jean-Philippe Lang
101 2 Jean-Philippe Lang
h3. PUT
102 1 Jean-Philippe Lang
103 3 Jean-Philippe Lang
Updates an existing group.
104 3 Jean-Philippe Lang
105 2 Jean-Philippe Lang
h3. DELETE
106 1 Jean-Philippe Lang
107 3 Jean-Philippe Lang
Deletes an existing group.
108 3 Jean-Philippe Lang
109 1 Jean-Philippe Lang
h2. /groups/:id/users.:format
110 1 Jean-Philippe Lang
111 2 Jean-Philippe Lang
h3. POST
112 1 Jean-Philippe Lang
113 3 Jean-Philippe Lang
Adds an existing user to a group.
114 3 Jean-Philippe Lang
115 3 Jean-Philippe Lang
+Parameters+:
116 3 Jean-Philippe Lang
117 3 Jean-Philippe Lang
* @user_id@ (required): id of the user to add to the group.
118 3 Jean-Philippe Lang
119 3 Jean-Philippe Lang
+Example+:
120 3 Jean-Philippe Lang
121 3 Jean-Philippe Lang
<pre>
122 3 Jean-Philippe Lang
POST /groups/10/users.xml
123 3 Jean-Philippe Lang
124 3 Jean-Philippe Lang
<user_id>5</user_id>
125 3 Jean-Philippe Lang
</pre>
126 3 Jean-Philippe Lang
127 3 Jean-Philippe Lang
+Response+:
128 3 Jean-Philippe Lang
129 3 Jean-Philippe Lang
* @200 OK@: user was added to the group
130 3 Jean-Philippe Lang
131 1 Jean-Philippe Lang
h2. /groups/:id/users/:user_id.:format
132 1 Jean-Philippe Lang
133 1 Jean-Philippe Lang
h3. DELETE
134 3 Jean-Philippe Lang
135 3 Jean-Philippe Lang
Removes a user from a group.
136 3 Jean-Philippe Lang
137 3 Jean-Philippe Lang
+Example+:
138 3 Jean-Philippe Lang
139 3 Jean-Philippe Lang
<pre>
140 3 Jean-Philippe Lang
DELETE /groups/10/users/5.xml
141 3 Jean-Philippe Lang
</pre>
142 3 Jean-Philippe Lang
143 3 Jean-Philippe Lang
+Response+:
144 3 Jean-Philippe Lang
145 3 Jean-Philippe Lang
* @200 OK@: user was removed to the group