Use the DELETE method to remove a user from the specified group.

Request syntax

curl -X DELETE https://api.usergrid.com/<org>/<app>/groups/<group>/users/<user>"

Parameters

Parameter Description
org Organization UUID or organization name
app Application UUID or application name
group UUID or name of the group
user UUID, username or email of user to be deleted

Example request

curl -X DELETE https://api.usergrid.com/your-org/your-app/groups/someGroup/users/someUser

Example response

{
  "action" : "delete",
  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "uri" : "https://api.usergrid.com/your-org/your-app/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "entities" : [ {
    "uuid" : "74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
    "type" : "user",
    "name" : "someUser",
    "created" : 1401301104077,
    "modified" : 1401301104077,
    "username" : "someUser",
    "email" : "your-org@apigee.com",
    "activated" : true,
    "picture" : "http://www.gravatar.com/avatar/0455fc92de2636fc7a176cc5d298bb78",
    "metadata" : {
      "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
      "sets" : {
        "rolenames" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "permissions" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/permissions"
      },
      "collections" : {
        "activities" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/activities",
        "devices" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/devices",
        "feed" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/feed",
        "groups" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/groups",
        "roles" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "following" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/following",
        "followers" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/followers"
      }
    }
  } ],
  "timestamp" : 1401751485776,
  "duration" : 220,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

SDK method

-(ApigeeClientResponse *)removeUserFromGroup:(NSString *)user group:(NSString *)group

Parameters

Parameter Description
group UUID or name of the group
user UUID, username or email of user to be deleted

Example request

//we recommend you call ApigeeClient from your AppDelegate.
//for more information see the iOS SDK install guide: http://apigee.com/docs/app-services/content/installing-apigee-sdk-ios
//create an instance of AppDelegate
AppDelegate *appDelegate = (AppDelegate *)[ [UIApplication sharedApplication] delegate];

//the group and user we want to disconnect
NSString *group = @"someGroup";
NSString *user = @"someUser";

//call removeUserFromGroup:User: to initiate the API DELETE request to disconnect the entities
ApigeeClientResponse *response = [appDelegate.dataClient removeUserFromGroup:user group:group];

@try {
    //success
}
@catch (NSException * e) {
    //fail
}
		

Example response

{
    action = delete;
    application = "f34f4222-a166-11e2-a7f7-02e81adcf3d0";
    applicationName = your-app;
    duration = 270;
    entities =     (
                {
            activated = 1;
            created = 1401301104077;
            email = "your-org@apigee.com";
            metadata =             {
                collections =                 {
                    activities = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/activities";
                    devices = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/devices";
                    feed = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/feed";
                    followers = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/followers";
                    following = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/following";
                    groups = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/groups";
                    roles = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles";
                };
                path = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3";
                sets =                 {
                    permissions = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/permissions";
                    rolenames = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles";
                };
            };
            modified = 1401301104077;
            name = someUser;
            picture = "http://www.gravatar.com/avatar/0455fc92de2636fc7a176cc5d298bb78";
            type = user;
            username = someUser;
            uuid = "74d2d7da-e694-11e3-b0c6-4d2664c8e0c3";
        }
    );
    organization = your-org;
    params =     {
    };
    path = "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users";
    timestamp = 1401752138545;
    uri = "https://api.usergrid.com/your-org/your-app/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users";
}
		

SDK method

Asynchronous

public void removeUserFromGroupAsync(final String userId, final String groupId,
			final ApiResponseCallback callback)
    

Synchronous

public void removeUserFromGroup(String user, String group)

Parameters

Parameter Description
group UUID or name of the group
user UUID, username or email of user to be deleted

Example request

//get an instance of ApigeeClient to access API request methods
ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME,this.getBaseContext());
DataClient client = apigeeClient.getDataClient();

//the user and group we want to disconnect
String user = "someUser";
String group = "someGroup";

//call removeUserFromGroupAsync to initiate the async DELETE request
client.removeUserFromGroupAsync(user, group, new ApiResponseCallback() {
	@Override
	public void onException(Exception e) { 
		// Error		
	}
	
	@Override
	public void onResponse(ApiResponse response) {
	    try { 
	        if (response != null) {
	            // Success	        	
	        }
	    } catch (Exception e) { //The API request returned an error
	        	// Fail	    	
	    }
	}
});	
		

Example response

{
  "action" : "delete",
  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "uri" : "https://api.usergrid.com/your-org/your-app/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "entities" : [ {
    "uuid" : "74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
    "type" : "user",
    "name" : "someUser",
    "created" : 1401301104077,
    "modified" : 1401301104077,
    "username" : "someUser",
    "email" : "your-org@apigee.com",
    "activated" : true,
    "picture" : "http://www.gravatar.com/avatar/0455fc92de2636fc7a176cc5d298bb78",
    "metadata" : {
      "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
      "sets" : {
        "rolenames" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "permissions" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/permissions"
      },
      "collections" : {
        "activities" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/activities",
        "devices" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/devices",
        "feed" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/feed",
        "groups" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/groups",
        "roles" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "following" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/following",
        "followers" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/followers"
      }
    }
  } ],
  "timestamp" : 1401752721929,
  "duration" : 251,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

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

SDK method

Group.remove(options, callback)

Parameters

Parameter Description
options

A JSON object containing the following:

  • user: A JSON object containing a username property with a value of the username, UUID, or email of the user being removed.
callback A callback function to handle the async response.

Example request

//get an instance of Apigee.Client to call API request methods
var dataClient = new Apigee.Client({
    orgName:'your-org',
    appName:'your-app',
});

//create a Apigee.Group instance to model the group we want to
//remove the user from
var group_options = {
    client: dataClient,
    path: '/someGroup'
};

var group = new Apigee.Group(group_options);

//create an options object that contains the username, password
//or UUID of the user to be removed
var options = {
    user: {
        username: 'someUser'
    }
};

//call Group.remove() to initiate the API DELETE request
group.remove(options, function (error, result) {

    if (error) { 
        // Error
    } else { 
        // Success
    }

});
		

Example response

		

The example assumes use of the Ruby SDK.

Example request

app = Usergrid::Application.new 'https://api.usergrid.com/your-org/your-app/'
app['groups/someGroup/users/someUser'].delete
		

Example response

{
  "action" : "delete",
  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "uri" : "https://api.usergrid.com/your-org/your-app/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users",
  "entities" : [ {
    "uuid" : "74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
    "type" : "user",
    "name" : "someUser",
    "created" : 1401301104077,
    "modified" : 1401301104077,
    "username" : "someUser",
    "email" : "your-org@apigee.com",
    "activated" : true,
    "picture" : "http://www.gravatar.com/avatar/0455fc92de2636fc7a176cc5d298bb78",
    "metadata" : {
      "path" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3",
      "sets" : {
        "rolenames" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "permissions" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/permissions"
      },
      "collections" : {
        "activities" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/activities",
        "devices" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/devices",
        "feed" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/feed",
        "groups" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/groups",
        "roles" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/roles",
        "following" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/following",
        "followers" : "/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users/74d2d7da-e694-11e3-b0c6-4d2664c8e0c3/followers"
      }
    }
  } ],
  "timestamp" : 1401906054848,
  "duration" : 265,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

The example assumes use of the Node.js module.

SDK method

Group.remove(options, callback)

Parameters

Parameter Description
options

A JSON object containing the following:

  • user: A JSON object containing a username property with a value of the username, UUID, or email of the user being removed.
callback A callback function to handle the async response.

Example request

//get an instance of Usergrid.client to call API request methods
var dataClient = new Usergrid.client({
    orgName:'your-org',
    appName:'your-app',
});

//create a Usergrid.group instance to model the group we want to
//remove the user from
var group_options = {
    client: dataClient,
    path: '/someGroup'
};

var group = new Usergrid.group(group_options);

//create an options object that contains the username, password
//or UUID of the user to be removed
var options = {
    user: {
        username: 'someUser'
    }
};

//call Group.remove() to initiate the API DELETE request
group.remove(options, function (error, result) {

    if (error) { 
        // Error
    } else { 
        // Success
    }

});
		

Example response

{ action: 'get',
  application: 'f34f4222-a166-11e2-a7f7-02e81adcf3d0',
  params: {},
  path: '/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users',
  uri: 'https://api.usergrid.com/your-org/your-app/groups/cd796d0a-b90c-11e3-83de-83ceb9965c26/users',
  entities: 
   [ { uuid: '3dcf572a-b379-11e3-abd2-d3404514993c',
       type: 'user',
       name: 'test',
       created: 1395681906066,
       modified: 1399067965357,
       username: 'greg',
       activated: true,
       file: '{\n  "action" : "delete",\n  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",\n  "params" : { },\n  "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",\n  "uri" : "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",\n  "entities" : [ {\n    "uuid" : "5bcc47ca-cfed-11e3-8bde-a7e008061e10",\n    "type" : "user",\n    "created" : 1398810410556,\n    "modified" : 1398810410556,\n    "username" : "Ford",\n    "activated" : true,\n    "metadata" : {\n      "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10",\n      "sets" : {\n        "rolenames" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",\n        "permissions" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/permissions"\n      },\n      "connections" : {\n        "friends" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/friends",\n        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/likes"\n      },\n      "collections" : {\n        "activities" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/activities",\n        "devices" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/devices",\n        "feed" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/feed",\n        "groups" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/groups",\n        "roles" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",\n        "following" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/following",\n        "followers" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/followers"\n      }\n    }\n  } ],\n  "timestamp" : 1398975691095,\n  "duration" : 49,\n  "organization" : "your-org",\n  "applicationName" : "your-app"\n}\n',
       'file-metadata': [Object],
       metadata: [Object] } ],
  timestamp: 1401901935890,
  duration: 27,
  organization: 'your-org',
  applicationName: 'your-app' }
		

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)