Delete Objects from relation¶
The API removes specific objects from a relationship with their parent.
Method¶
DELETE
Endpoint URL¶
The xxxx.backendless.app
is a subdomain assigned to your application. For more information see the Client-side Setup section of this documentation.
https://xxxx.backendless.app/api/data/<table-name>/<parentObjectId>/<relationName>
where:
Argument | Description |
---|---|
<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
.
Important
Make sure to replace xxxx in the domain name in the sample request below to the one assigned to your application.
curl \
-H Content-Type:application/json \
-X DELETE
-d "{ \"XXXXX-XXXXX-XXXXX-XXXXX\", \"ZZZZ-ZZZZ-ZZZZZ-ZZZZZ\" }" \
https://xxxx.backendless.app/api/data/Person/parentObjectId/address