Delete method (Restful)

Asked

Viewed 153 times

1

Would you like to know how I make a delete method that gets a list by parameters? I mean, instead of just passing the ID of the item to be deleted, I want to allow you to be selected N items and removed all at once, in a single request.

How to do this semantically and to meet the standards?

1 answer

0

You can pass an array of integers or a list of integers as parameter. When deleting Voce opens a transaction, traverses its array and deletes record by record, when finished, Voce commits the transaction.

I don’t know the java to write the code for Voce, but I do it this way in . NET when I need something similar...

  • Hello André, thanks for the quick reply! ?

  • I was gonna do it the way you said. But I wanted to try not to break the Restful pattern, and so I turned to the forum to find out how to do this in a semantic and standardized way.

  • Whenever Cvoce is making a request, the legal is to send the data via POST, in this case, the data would be 'hidden' in the request and the URI would remain the same. The data would be transmitted via JSON in this case...

  • André, this is exactly what I can’t do. kkk

  • You see, REST preaches proper use of HTTP methods. In this case, I must make use of the @DELETE method that the HTTP protocol offers.

  • Sorry, fnx... I’m actually kind of backend programing, front though I do, it’s not really my strong... Take a look at this answer... http://stackoverflow.com/questions/28054515/how-to-send-delete-with-json-to-the-rest-api-using-httpclient

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.