Skip to content

Deleting Multiple Objects

This API deletes multiple objects in a data table with a single request. Consider the following example, it demonstrates an API call which deletes all objects in the Person data table where the value of the age property is greater than 20:

curl -X DELETE \  
 'https://api.backendless.com/application-id/REST-api-key/data/bulk/Person?where=age%20%3E%2010'

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/bulk/<table-name>?where=<where clause>

where:

Argument                Description
<table-name> name of the table where the objects need to be deleted.
<where clause> a condition for selecting the objects in the targeted table for the bulk delete. Must be a URL-encoded value.

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. 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

None.

Response Body

The API returns the number object of objects deleted as a result of the request.

Codeless Reference

data_service_bulk_delete

where:

Argument                Description
table name Name of the data table where objects will be deleted from.
where clause A condition for selecting objects to be deleted in the data table. Refer to the Search With The Where Clause topic for more information.

Returns the number of deleted objects.

Consider the following records in the employees data table:

data_service_example_delete_object_3

The example below is set to delete all values from the position column that match the where clause condition, (e.g. 'Manager'). In this case, the condition acts like a filter and deletes all values that match the criteria 'Manager'.

data_service_example_bulk_delete

The result of this operation will look as shown below after the Codeless logic runs. As you can see, two records containing the 'Manager' value in the position column were deleted from the data table.

data_service_example_bulk_delete_2

Also, the operation has returned the number 2, indicating the number of deleted objects in the employees data table.

data_service_example_bulk_update_4