Im wondering if its bad idea for me to send
DELETE Request on server endpoint
I am aware that
DELETE Requests shouldn’t include req.body.
Does it matter if i pass information via params or query? or is there perhaps better way to sending info as delete request in order to delete some info from db?
Feels like just matter of semantics.
Thanks for answers in advance.
In general, if you have a RESTful API, and you want to refer to a resource you use URL parameters as you want to identify that single resource.
So you would have something like
As it’s a single resource of
However, you may want to delete multiple resources and in that case, it is a common practice to use query parameters
So the "best practice" that you might be missing here is that you should use nouns instead of verbs in endpoints as you are dealing with
Unless you design your API in a way that you trigger a deletion task/process by calling this endpoint then you can challenge this recommendations.