To disconnect a user from other data, perform a DELETE operation against the same endpoint at which you posted to create the connection.

Request syntax

Disconnect by UUID

curl -X DELETE https://api.usergrid.com/<org>/<app>/<connecting_collection>/<connecting_entity>/<relationship>/<connected_entity>

Disconnect by 'name' property

curl -X DELETE https://api.usergrid.com/<org>/<app>/<connecting_collection>/<connecting_entity>/<relationship>/<connected_collection>/<connected_entity>

Parameters

Parameter Description
org Organization UUID or organization name
app Application UUID or application name
connecting_collection Name or UUID of the collection of the connecting entity.
connecting_entity Name or UUID of the connecting entity. If the connecting entity is a 'user' entity, the 'username' should be used rather than the 'name'
relationship disconnectType of connection being disconnected from (e.g., likes)
connected_collection Name or UUID of the collection of the entity being disconencted from. This is not required if the entity being disconnected from is specified by its UUID.
connected_entity Name or UUID of the entity being disconnected from. If no collection is specified in the request, the UUID must be used.

Example request

curl -X DELETE https://api.usergrid.com/your-org/your-app/users/Arthur/likes/users/Ford

Example response

{
  "action" : "delete",
  "application" : "k88dh4f-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "uri" : "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "entities" : [ {
    "uuid" : "5bcc47ca-cfed-11e3-8bde-a7e008061e10",
    "type" : "user",
    "created" : 1398810410556,
    "modified" : 1398810410556,
    "username" : "Ford",
    "activated" : true,
    "metadata" : {
      "connecting" : {
        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/connecting/likes"
      },
      "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10",
      "sets" : {
        "rolenames" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "permissions" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/permissions"
      },
      "connections" : {
        "friends" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/friends",
        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/likes"
      },
      "collections" : {
        "activities" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/activities",
        "devices" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/devices",
        "feed" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/feed",
        "groups" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/groups",
        "roles" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "following" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/following",
        "followers" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/followers"
      }
    }
  } ],
  "timestamp" : 1398962837195,
  "duration" : 85,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

SDK method

Disconnect by 'name' property

(ApigeeClientResponse *)disconnectEntitiesByName:(NSString *)connecting_collection
                          connectorID:(NSString *)connecting_entity
                                 type:(NSString *)relationship
                        connecteeType:(NSString *)connected_collection
                          connecteeID:(NSString *)connected_entity	
		

Disconnect by UUID

(ApigeeClientResponse *)disconnectEntities:(NSString *)connecting_entity
                          connectorID:(NSString *)connecting_entity
                                 type:(NSString *)relationship                        
                          connecteeID:(NSString *)connected_entity
		

Parameters

Parameter Description
connecting_collection Name or UUID of the collection of the connecting entity.
connecting_entity Name or UUID of the connecting entity. If the connecting entity is a 'user' entity, the 'username' should be used rather than the 'name'
relationship disconnectType of connection being disconnected from (e.g., likes)
connected_collection Name or UUID of the collection of the entity being disconencted from. This is not required if the entity being disconnected from is specified by its UUID.
connected_entity Name or UUID of the entity being disconnected from. If no collection is specified in the request, the UUID must be used.

Example request

NSString *connecting_collection = @"users";
NSString *connecting_entity = @"Arthur";
NSString *relationship = @"likes";
NSString *connected_entity = @"5bcc47ca-cfed-11e3-8bde-a7e008061e10";

//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];

ApigeeClientResponse *response = [appDelegate.dataClient disconnectEntities:connecting_collection connectorID:connecting_entity type:relationship connecteeID:@connected_entity];

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

Example response

{
    action = delete;
    application = "k88dh4f-a166-11e2-a7f7-02e81adcf3d0";
    applicationName = your-app;
    duration = 52;
    entities =     (
                {
            activated = 1;
            created = 1398810410556;
            metadata =             {
                collections =                 {
                    activities = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/activities";
                    devices = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/devices";
                    feed = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/feed";
                    followers = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/followers";
                    following = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/following";
                    groups = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/groups";
                    roles = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles";
                };
                connecting =                 {
                    likes = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/connecting/likes";
                };
                connections =                 {
                    friends = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/friends";
                    likes = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/likes";
                };
                path = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10";
                sets =                 {
                    permissions = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/permissions";
                    rolenames = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles";
                };
            };
            modified = 1398810410556;
            type = user;
            username = Ford;
            uuid = "5bcc47ca-cfed-11e3-8bde-a7e008061e10";
        }
    );
    organization = your-org;
    params =     {
    };
    path = "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes";
    timestamp = 1398965083492;
    uri = "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes";
}
		

SDK method

Synchronous:

Disconnect by 'name' property

disconnectEntitiesAsync(String connectingEntityType,
			String connectingEntityId, String connectionType,
			String connectedEntityType, String connectedEntityId)
		

Disconnect by UUID

disconnectEntitiesAsync(String connectingEntityType,
			String connectingEntityId, String connectionType,
			String connectedEntityId)
		

Asynchronous:

Disconnect by 'name' property

disconnectEntitiesAsync(String connectingEntityType,
			String connectingEntityId, String connectionType,
			String connectedEntityType, String connectedEntityId, 
			ApiResponseCallback callback)
		

Disconnect by UUID

disconnectEntitiesAsync(String connectingEntityType,
			String connectingEntityId, String connectionType,
			String connectedEntityId, ApiResponseCallback callback)
		

Parameters

Parameter Description
connecting_collection Name or UUID of the collection of the connecting entity.
connecting_entity Name or UUID of the connecting entity. If the connecting entity is a 'user' entity, the 'username' should be used rather than the 'name'
relationship disconnectType of connection being disconnected from (e.g., likes)
connected_collection Name or UUID of the collection of the entity being disconencted from. This is not required if the entity being disconnected from is specified by its UUID.
connected_entity Name or UUID of the entity being disconnected from. If no collection is specified in the request, the UUID must be used.
callback Asynchronous calls only. An ApiResponse object to handle the async response.

Example request

String ORGNAME = "your-org";
String APPNAME = "your-app";

//create an instance of ApigeeClient to carry your org and app name
ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME,this.getBaseContext());
DataClient client = apigeeClient.getDataClient();

//specify the two entities to be disconnected
String connecting_collection = "users";
String connecting_entity = "Arthur";
String relationship = "likes";
String connected_collection = "users";
String connected_entity = "Ford";

//initialize the DELETE request 
client.disconnectEntitiesAsync(connecting_collection, connecting_entity, relationship, connected_collection, connected_entity, 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" : "k88dh4f-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "uri" : "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "entities" : [ {
    "uuid" : "5bcc47ca-cfed-11e3-8bde-a7e008061e10",
    "type" : "user",
    "created" : 1398810410556,
    "modified" : 1398810410556,
    "username" : "Ford",
    "activated" : true,
    "metadata" : {
      "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10",
      "sets" : {
        "rolenames" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "permissions" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/permissions"
      },
      "connections" : {
        "friends" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/friends",
        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/likes"
      },
      "collections" : {
        "activities" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/activities",
        "devices" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/devices",
        "feed" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/feed",
        "groups" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/groups",
        "roles" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "following" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/following",
        "followers" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/followers"
      }
    }
  } ],
  "timestamp" : 1398975691095,
  "duration" : 49,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

SDK method

Entity.disconnect(relationship, connected_entity, callback)

Parameters

Parameter Description
relationship Type of connection being disconnected (e.g., likes).
connected_entity An Apigee.Entity object that models the entity being disconnected from.
callback Callback function to handle the async response.

Example request

var dataClient = new Apigee.Client({
    orgName:'your-org',
    appName:'your-app',
});

var connecting_entity_options = {
    client: dataClient,
    data: {
        type:'users',
        username:'Arthur'
    }
};
var connecting_entity = new Apigee.Entity(connecting_entity_options);

var connected_entity_options = {
    client: dataClient,
    data: {
        type:'users',
        username:'Ford'
    }
};
var connected_entity = new Apigee.Entity(connected_entity_options);

var relationship = 'likes';

connecting_entity.disconnect(relationship, connected_entity, function (error, result) {

	if (error) { 
        // Error
	} else { 
		// Success
		console.log(result);
	}

});
		

Example response

Object {action: "delete", application: "k88dh4f-a166-11e2-a7f7-02e81adcf3d0", params: Object, path: "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes", uri: "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes"…}
action: "delete"
application: "k88dh4f-a166-11e2-a7f7-02e81adcf3d0"
applicationName: "your-app"
duration: 89
entities: Array[1]
0: Object
activated: true
created: 1398810410556
metadata: Object
modified: 1398810410556
type: "user"
username: "Ford"
uuid: "5bcc47ca-cfed-11e3-8bde-a7e008061e10"
__proto__: Object
length: 1
__proto__: Array[0]
organization: "your-org"
params: Object
path: "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes"
timestamp: 1398978254728
uri: "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes"
		

Example request

usergrid_api = 'https://api.usergrid.com/'
organization = 'your-org'
application = 'your-app'

client = Usergrid::Application.new "#{usergrid_api}/#{organization}/#{application}"

begin
response = client['users/Arthur/likes/users/Ford'].delete

rescue
	#fail
end
		

Example response

{
  "action" : "delete",
  "application" : "k88dh4f-a166-11e2-a7f7-02e81adcf3d0",
  "params" : { },
  "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "uri" : "https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes",
  "entities" : [ {
    "uuid" : "5bcc47ca-cfed-11e3-8bde-a7e008061e10",
    "type" : "user",
    "created" : 1398810410556,
    "modified" : 1398810410556,
    "username" : "Ford",
    "activated" : true,
    "metadata" : {
      "connecting" : {
        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/connecting/likes"
      },
      "path" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10",
      "sets" : {
        "rolenames" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "permissions" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/permissions"
      },
      "connections" : {
        "friends" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/friends",
        "likes" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/likes"
      },
      "collections" : {
        "activities" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/activities",
        "devices" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/devices",
        "feed" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/feed",
        "groups" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/groups",
        "roles" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/roles",
        "following" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/following",
        "followers" : "/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes/5bcc47ca-cfed-11e3-8bde-a7e008061e10/followers"
      }
    }
  } ],
  "timestamp" : 1398978691758,
  "duration" : 68,
  "organization" : "your-org",
  "applicationName" : "your-app"
}
		

SDK method

Entity.disconnect(relationship, connected_entity, callback)

Parameters

Parameter Description
relationship Type of connection being disconnected (e.g., likes).
connected_entity An Apigee.Entity object that models the entity being disconnected from.
callback Callback function to handle the async response.

Example request

// create an Usergrid.Client instance to carry your account details           
var dataClient = new Usergrid.client({
    orgName:'your-org',
    appName:'your-app',
});

var connecting_entity_options = {
    client: dataClient,
    data: {
        type:'users',
        username:'Arthur'
    }
};
var connecting_entity = new Usergrid.entity(connecting_entity_options);

var connected_entity_options = {
    client: dataClient,
    data: {
        type:'users',
        username:'Ford'
    }
};
var connected_entity = new Usergrid.entity(connected_entity_options);

var relationship = 'likes';

connecting_entity.disconnect(relationship, connected_entity, function (error, result) {

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

Example response

{ action: 'delete',
  application: 'k88dh4f-a166-11e2-a7f7-02e81adcf3d0',
  params: {},
  path: '/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes',
  uri: 'https://api.usergrid.com/your-org/your-app/users/58606d0a-cfed-11e3-a694-dbf5228024a7/likes',
  entities: 
   [ { uuid: '5bcc47ca-cfed-11e3-8bde-a7e008061e10',
       type: 'user',
       created: 1398810410556,
       modified: 1398810410556,
       username: 'Ford',
       activated: true,
       metadata: [Object] } ],
  timestamp: 1398978490094,
  duration: 71,
  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?)