How to send a resource collection using Restangular?

Issue

Let’s say I want to send a DELETE request to a resource like /products and I want to delete multiple products.

The whole request would be to the following URI: /products/ids=1&ids=2&ids=3

How can I issue a request like the above one using Restangular?

For now, the issue is that customDELETE receives query string params using an object. Hence, it can’t define the same parameter more than once…

Solution

Finally it was an easy one:

products.one().customDELETE(null, { ids: [1,2,3,5] } });

Answered By – Matías Fidemraizer

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.