Bulk update and delete data objects (using a REST Advanced Search syntax)

We have a query command here (using a GET method)http://backendless.com/documentation/data/rest/data_search_and_query.htm

It would be very useful to have similar commands with PUT and DELETE methods, to update or delete a bulk of objects satisfying the query.

I look forward to that. Thanks

Hi Alex,

Thank you for the suggestion! I can see how this could work for the DELETE operation, what would be the use-case for PUT? Update specific properties with the specified value for all objects that matched the criteria?

Regards,
Mark

Hi, Mark.

Yes, update properties specified in the request body, just like for a one object.

For example, I want to archive some notes, so I need to set the ‘archived’ property for a batch of objects.

Method: PUT
URL: https://api.backendless.com/v1/data/Notes?where=someQuery
BODY: {archived: true}

I’m suprised, that I’m the first who asked about it :slight_smile:

Have you made any decision? ETA?

Hi Alex,

I added it to the current iteration. We will do our best to squeeze it in for the upcoming release (it is about 3 weeks out).

Regards,
Mark

Great! Thanks :slight_smile:

Hi! Any updates? :slight_smile:

Hi Alex,

It was added in the current iteration. The release has slipped several times, but it should be a matter of days now before we publish it.

Regards,
Mark

Hi Alex,

You can test bulk update/delete requests.
See the following examples:

  1. Add Person:
curl 
-H application-id:application-id-value-from-console
-H secret-key:secret-key-value-from-console 
-H Content-Type:application/json 
-X POST 
-d "{\"name\":\"Bob\", \"age\":20, \"salary\":0, \"workDays\":\"20\"}" 
-v https://api.backendless.com/v1/data/Person
  1. Update with bulk:
curl 
-H application-id:application-id-value-from-console
-H secret-key:secret-key-value-from-console 
-H Content-Type:application/json 
-X PUT 
-d "{\"salary\":1000}" 
-v https://api.backendless.com/v1/data/bulk/Person?where%3DworkDays%3E10

or Delete with bulk:

curl 
-H application-id:application-id-value-from-console
-H secret-key:secret-key-value-from-console 
-H Content-Type:application/json 
-X DELETE
-v https://api.backendless.com/v1/data/bulk/Person?where%3DworkDays%3D20

Thank you for your patience!

Is there a way to do this with the actionscript SDK? I’m particularly interested in bulk deletes

The feature is available only through REST. You can still use it from ActionScript, but you’d need to write extra code to make the REST request.

Regards,
Mark