3 ms·
HTTP Method DELETE. Payload: empty. I know DELETE is not supposed to have any payload, but using PATCH is awkward if you have to delete multiple resources base
by rodionos 10y ago
HTTP Method DELETE. Payload: empty.
I know DELETE is not supposed to have any payload, but using PATCH is awkward if you have to delete multiple resources based on a query or a filter. You need to specify a 'delete' action as part of PATCH request which means the payload model has to be different. Just awkward.
- euyyn 10y agoYou face the same problem if you want to just list multiple resources based on a query or a filter. The solution isn't to send a GET with an HTTP body, which is counterintuitive to most people, and many proxies just drop. It's to make your filter part of the URL (as a query parameter). Same with DELETE.
- veesahni 10y agoA bulk deletion isn't defined as part of their "Standard Methods" .. For stuff that doesn't fit the standard methods, they have this page on custom methods: https://cloud.google.com/apis/design/custom_methods https://cloud.google.com/apis/design/custom_methods That said, I'd implement a bulk deletion in one of three ways: :::: ONE DELETE /thingies/id1,id2,id3 When all is ok, the response is a 200. However, if one of the deletions fail, how you handle the response is more complicated. :::: TWO POST /thingies/bulk_delete and have your ID's listed in the body. Still same problem with handling the response. :::: THREE POST /bulk Instead of implementing a bulk deletion at all, think about how you can implement "bulk requests" as a higher level feature of the API. So you can transport a bunch of delete's as part of a single HTTP request, and get back a bunch of response codes packaged into a single response.
- rodionos 10y agoPOST /thingies/bulk_delete Exactly. That's the approach we've taken. It has worked better for us than sending a delete action via PATCH.