Restangular DELETE request, send data in body

Issue

I am using restangular to send DELETE request.
I send some data in the request, and data is added to query string. But I want to use body instead of URI. I’ve found this question on stackoverflow. Mgonto said, that this problem can be resolved, by using customDELETE method.
I’ve tried something like this:

Restangular.all("all").customDELETE("one", {
firstParam: 1,
secondParam: 2
});

Unfortunately parameters still sent in the URI.
Is there any way to send parameters in body?? Like in POST request??

Solution

My teamlead helped me to find a solution!
We can use customOperation to send data in body of our request.
Here’s an example:

Restangular.all("all/one").customOperation("remove", null, null, {
firstParam: 1,
secondParam: 2
});

It works fine for me!
Hope it’ll help someone!

Answered By – Sergey Tyupaev

Answer Checked By – Candace Johnson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.