Rest Groups » History » Version 3

« Previous - Version 3/9 (diff) - Next » - Current version
Jean-Philippe Lang, 2012-06-03 15:15


Groups

/groups.:format

GET

Returns the list of groups.

Example:

GET /groups.xml

Response:

<groups type="array">
  <group>
    <id>53</id>
    <name>Managers</name>
  </group>
  <group>
    <id>55</id>
    <name>Developers</name>
  </group>
</groups>

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:

POST /groups.xml

<group>
  <name>Developers</name>
  <user_ids>
    <user_id>3</user_id>
    <user_id>5</user_id>
  </user_ids>
</group>

Response:

  • 201 Created: group was created
  • 422 Unprocessable Entity: group was not created due to validation failures (response body contains the error messages)

/groups/:id.:format

PUT

Updates an existing group.

DELETE

Deletes an existing group.

/groups/:id/users.:format

POST

Adds an existing user to a group.

Parameters:

  • user_id (required): id of the user to add to the group.

Example:

POST /groups/10/users.xml

<user_id>5</user_id>

Response:

  • 200 OK: user was added to the group

/groups/:id/users/:user_id.:format

DELETE

Removes a user from a group.

Example:

DELETE /groups/10/users/5.xml

Response:

  • 200 OK: user was removed to the group