Skip to content

Delete Objects from relation

The API removes specific objects from a relationship with their parent.

Method

DELETE

URL

https://api.backendless.com/<application-id>/<REST-api-key>/data/<table-name>/<parentObjectId>/<relationName> 

where:

Argument                Description
<application-id> the ID of your application generated upon its creation. You can obtain the value in the Manage > App Settings section of the Backendless Console.
<REST-api-key> REST API key of your application. You can obtain the value in the Manage > App Settings section of the Backendless Console.
<table-name> name of the table where which contains the parent object as identified by <parentObjectId>.
<parentObjectId> id of the object for which the relation will be deleted.
<relationName> name of the column which identifies the relation within the parent table (identified as <table-name>).

Request Headers

user-token: value-of-the-user-token-header-from-login  
Content-Type:application/json

where:

Argument                Description
user-token Optional header. Contains a value returned by Backendless in a preceding user Login API call. If user-token is set in the request, the operation will be executed with the security policy associated with the currently logged in user. This means all permissions associated with the user and the roles assigned to the user will be enforced by Backendless.
Content-Type Must be set to application/json. This header is mandatory.

Request Body

Must be an array of child object IDs as string values.

[  
  "childObjectId1", "childObjectId2"  
]

Return Value

Error or number of objects the operation deleted for the relation.

Example

The example below deletes a relation between a Person object and its children. The child objects are referenced explicitly in the API call (see the object IDs in the body as "XXXXX-XXXXX-XXXXX-XXXXX" ``and`` "ZZZZ-ZZZZ-ZZZZZ-ZZZZZ").The relation column is address.

curl \  
-H Content-Type:application/json \  
-X DELETE  
-d "{ \"XXXXX-XXXXX-XXXXX-XXXXX\", \"ZZZZ-ZZZZ-ZZZZZ-ZZZZZ\" }" \  
https://api.backendless.com/application-id/REST-api-key/data/Person/parentObjectId/address