Retrieving a group's users

Use the GET method to retrieve all the users in a group.

Request URI

GET /{org_id}/{app_id}/groups/{uuid|groupname}/users

Parameters

Parameter Description
arg uuid|string org_id Organization UUID or organization name
arg uuid|string app_id Application UUID or application name
arg uuid|string groupname UUID or name of the group

Example - Request

cURL

curl -X GET "https://api.usergrid.com/my-org/my-app/groups/mygroup/users"

JavaScript (HTML5)

The example assumes use of the JavaScript (HTML5) SDK.

var options = {
    method:'GET',
    endpoint:'groups/mygroup/users'
};
client.request(options, function (err, data) {
    if (err) {
        //error
    } else {
        //success - data will contain raw results from API call
    }
});

Ruby

The example assumes use of the Ruby SDK.

app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
activities = app['groups/mygroup/users'].collection

Node.js

The example assumes use of the Node.js module.

var options = {
    method:'GET',
    endpoint:'groups/mygroup/users'
};
client.request(options, function (err, data) {
    if (err) {
        //error
    } else {
        //success - data will contain raw results from API call
    }
});

Example - Response

{
  "action" : "get",
  "application" : "e7127751-6985-11e2-8078-02e81aeb2129",
  "params" : { },
  "path" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users",
  "uri" : "http://api.usergrid.com/myorg/sandbox/groups/d20976ff-802f-11e2-b690-02e81ae61238/users",
  "entities" : [ {
    "uuid" : "cd789b00-698b-11e2-a6e3-02e81ae236e9",
    "type" : "user",
    "name" : "barney",
    "created" : 1359405994314,
    "modified" : 1361894320470,
    "activated" : true,
    "email" : "barney@apigee.com",
    "metadata" : {
      "path" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9",
      "sets" : {
        "rolenames" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/rolenames",
        "permissions" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/permissions"
      },
      "collections" : {
        "activities" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/activities",
        "devices" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/devices",
        "feed" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/feed",
        "groups" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/groups",
        "roles" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/roles",
        "following" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/following",
        "followers" : "/groups/d20976ff-802f-11e2-b690-02e81ae66238/users/cd789b00-698b-11e2-a6e3-02e81aeb26e9/followers"
      }
    },
    "name" : "barney",
    "picture" : "http://www.gravatar.com/avatar/00767101f6b4f2cf5d02ed510dbcf0b4",
    "test" : "fred",
    "username" : "barney"
  } ],
  "timestamp" : 1361903248398,
  "duration" : 24,
  "organization" : "myorg",
  "applicationName" : "sandbox"
}