Rest Groups » History » Version 8

Cyril Jouve, 2017-08-30 12:23

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 8 Cyril Jouve
This endpoint requires admin privileges.
12 8 Cyril Jouve
13 1 Jean-Philippe Lang
+Example+:
14 1 Jean-Philippe Lang
15 1 Jean-Philippe Lang
  GET /groups.xml
16 1 Jean-Philippe Lang
17 1 Jean-Philippe Lang
+Response+:
18 1 Jean-Philippe Lang
19 1 Jean-Philippe Lang
<pre>
20 1 Jean-Philippe Lang
<groups type="array">
21 1 Jean-Philippe Lang
  <group>
22 1 Jean-Philippe Lang
    <id>53</id>
23 1 Jean-Philippe Lang
    <name>Managers</name>
24 1 Jean-Philippe Lang
  </group>
25 1 Jean-Philippe Lang
  <group>
26 1 Jean-Philippe Lang
    <id>55</id>
27 1 Jean-Philippe Lang
    <name>Developers</name>
28 1 Jean-Philippe Lang
  </group>
29 1 Jean-Philippe Lang
</groups>
30 1 Jean-Philippe Lang
</pre>
31 1 Jean-Philippe Lang
32 1 Jean-Philippe Lang
h3. POST
33 1 Jean-Philippe Lang
34 1 Jean-Philippe Lang
Creates a group.
35 1 Jean-Philippe Lang
36 8 Cyril Jouve
This endpoint requires admin privileges.
37 8 Cyril Jouve
38 1 Jean-Philippe Lang
+Parameters+:
39 1 Jean-Philippe Lang
40 1 Jean-Philippe Lang
* @group@ (required): a hash of the group attributes, including:
41 1 Jean-Philippe Lang
42 1 Jean-Philippe Lang
  * @name@ (required): the group name
43 1 Jean-Philippe Lang
  * @user_ids@: ids of the group users (an empty group is created if not provided)
44 1 Jean-Philippe Lang
45 1 Jean-Philippe Lang
+Example+:
46 1 Jean-Philippe Lang
47 1 Jean-Philippe Lang
<pre>
48 1 Jean-Philippe Lang
POST /groups.xml
49 1 Jean-Philippe Lang
50 1 Jean-Philippe Lang
<group>
51 1 Jean-Philippe Lang
  <name>Developers</name>
52 1 Jean-Philippe Lang
  <user_ids>
53 1 Jean-Philippe Lang
    <user_id>3</user_id>
54 1 Jean-Philippe Lang
    <user_id>5</user_id>
55 1 Jean-Philippe Lang
  </user_ids>
56 1 Jean-Philippe Lang
</group>
57 1 Jean-Philippe Lang
</pre>
58 1 Jean-Philippe Lang
59 6 Jean-Baptiste Barth
<pre>
60 6 Jean-Baptiste Barth
POST /groups.json
61 6 Jean-Baptiste Barth
62 6 Jean-Baptiste Barth
{
63 6 Jean-Baptiste Barth
  "group": {
64 6 Jean-Baptiste Barth
    "name": "Developers",
65 7 Matt Wiseley
    "user_ids": [ 3, 5 ]
66 6 Jean-Baptiste Barth
  }
67 6 Jean-Baptiste Barth
}
68 6 Jean-Baptiste Barth
</pre>
69 6 Jean-Baptiste Barth
70 1 Jean-Philippe Lang
+Response+:
71 1 Jean-Philippe Lang
72 1 Jean-Philippe Lang
  * @201 Created@: group was created
73 1 Jean-Philippe Lang
  * @422 Unprocessable Entity@: group was not created due to validation failures (response body contains the error messages)
74 1 Jean-Philippe Lang
75 1 Jean-Philippe Lang
h2. /groups/:id.:format
76 1 Jean-Philippe Lang
77 4 Jean-Philippe Lang
h3. GET
78 4 Jean-Philippe Lang
79 5 Jean-Philippe Lang
Returns details of a group.
80 4 Jean-Philippe Lang
81 8 Cyril Jouve
This endpoint requires admin privileges.
82 8 Cyril Jouve
83 4 Jean-Philippe Lang
+Parameters+:
84 4 Jean-Philippe Lang
85 4 Jean-Philippe Lang
* @include@ (optional): a coma separated list of associations to include in the response:
86 1 Jean-Philippe Lang
87 5 Jean-Philippe Lang
  * @users@
88 4 Jean-Philippe Lang
  * @memberships@
89 4 Jean-Philippe Lang
90 1 Jean-Philippe Lang
+Example+:
91 4 Jean-Philippe Lang
92 5 Jean-Philippe Lang
  GET /groups/20.xml?include=users
93 4 Jean-Philippe Lang
94 4 Jean-Philippe Lang
+Response+:
95 4 Jean-Philippe Lang
96 4 Jean-Philippe Lang
<pre>
97 4 Jean-Philippe Lang
<group>
98 4 Jean-Philippe Lang
  <id>20</id>
99 4 Jean-Philippe Lang
  <name>Developers</name>
100 4 Jean-Philippe Lang
  <users type="array">
101 4 Jean-Philippe Lang
    <user id="5" name="John Smith"/>
102 4 Jean-Philippe Lang
    <user id="8" name="Dave Loper"/>
103 4 Jean-Philippe Lang
  </users>
104 4 Jean-Philippe Lang
</group>
105 4 Jean-Philippe Lang
</pre>
106 4 Jean-Philippe Lang
107 2 Jean-Philippe Lang
h3. PUT
108 1 Jean-Philippe Lang
109 3 Jean-Philippe Lang
Updates an existing group.
110 3 Jean-Philippe Lang
111 8 Cyril Jouve
This endpoint requires admin privileges.
112 8 Cyril Jouve
113 2 Jean-Philippe Lang
h3. DELETE
114 1 Jean-Philippe Lang
115 3 Jean-Philippe Lang
Deletes an existing group.
116 3 Jean-Philippe Lang
117 8 Cyril Jouve
This endpoint requires admin privileges.
118 8 Cyril Jouve
119 1 Jean-Philippe Lang
h2. /groups/:id/users.:format
120 1 Jean-Philippe Lang
121 2 Jean-Philippe Lang
h3. POST
122 1 Jean-Philippe Lang
123 3 Jean-Philippe Lang
Adds an existing user to a group.
124 3 Jean-Philippe Lang
125 8 Cyril Jouve
This endpoint requires admin privileges.
126 8 Cyril Jouve
127 3 Jean-Philippe Lang
+Parameters+:
128 3 Jean-Philippe Lang
129 3 Jean-Philippe Lang
* @user_id@ (required): id of the user to add to the group.
130 3 Jean-Philippe Lang
131 3 Jean-Philippe Lang
+Example+:
132 3 Jean-Philippe Lang
133 3 Jean-Philippe Lang
<pre>
134 3 Jean-Philippe Lang
POST /groups/10/users.xml
135 3 Jean-Philippe Lang
136 3 Jean-Philippe Lang
<user_id>5</user_id>
137 3 Jean-Philippe Lang
</pre>
138 3 Jean-Philippe Lang
139 3 Jean-Philippe Lang
+Response+:
140 3 Jean-Philippe Lang
141 3 Jean-Philippe Lang
* @200 OK@: user was added to the group
142 3 Jean-Philippe Lang
143 1 Jean-Philippe Lang
h2. /groups/:id/users/:user_id.:format
144 1 Jean-Philippe Lang
145 1 Jean-Philippe Lang
h3. DELETE
146 3 Jean-Philippe Lang
147 3 Jean-Philippe Lang
Removes a user from a group.
148 8 Cyril Jouve
149 8 Cyril Jouve
This endpoint requires admin privileges.
150 3 Jean-Philippe Lang
151 3 Jean-Philippe Lang
+Example+:
152 3 Jean-Philippe Lang
153 3 Jean-Philippe Lang
<pre>
154 3 Jean-Philippe Lang
DELETE /groups/10/users/5.xml
155 3 Jean-Philippe Lang
</pre>
156 3 Jean-Philippe Lang
157 3 Jean-Philippe Lang
+Response+:
158 3 Jean-Philippe Lang
159 3 Jean-Philippe Lang
* @200 OK@: user was removed to the group