Rest Groups » History » Revision 5
Revision 4 (Jean-Philippe Lang, 2012-06-03 15:24) → Revision 5/10 (Jean-Philippe Lang, 2012-06-03 15:32)
h1. Groups {{>toc}} h2. /groups.:format h3. GET Returns the list of groups. +Example+: GET /groups.xml +Response+: <pre> <groups type="array"> <group> <id>53</id> <name>Managers</name> </group> <group> <id>55</id> <name>Developers</name> </group> </groups> </pre> h3. POST Creates a group. +Parameters+: * @group@ (required): a hash of the group attributes, including: * @name@ (required): the group name * @user_ids@: ids of the group users (an empty group is created if not provided) +Example+: <pre> POST /groups.xml <group> <name>Developers</name> <user_ids> <user_id>3</user_id> <user_id>5</user_id> </user_ids> </group> </pre> +Response+: * @201 Created@: group was created * @422 Unprocessable Entity@: group was not created due to validation failures (response body contains the error messages) h2. /groups/:id.:format h3. GET Returns details of and members for a group. +Parameters+: * @include@ (optional): a coma separated list of associations to include in the response: * @users@ * @memberships@ +Example+: GET /groups/20.xml?include=users /groups/20.xml +Response+: <pre> <group> <id>20</id> <name>Developers</name> <users type="array"> <user id="5" name="John Smith"/> <user id="8" name="Dave Loper"/> </users> </group> </pre> h3. PUT Updates an existing group. h3. DELETE Deletes an existing group. h2. /groups/:id/users.:format h3. POST Adds an existing user to a group. +Parameters+: * @user_id@ (required): id of the user to add to the group. +Example+: <pre> POST /groups/10/users.xml <user_id>5</user_id> </pre> +Response+: * @200 OK@: user was added to the group h2. /groups/:id/users/:user_id.:format h3. DELETE Removes a user from a group. +Example+: <pre> DELETE /groups/10/users/5.xml </pre> +Response+: * @200 OK@: user was removed to the group