REST, HTTP DELETE and parameters

后端 未结 4 1270
不知归路
不知归路 2020-11-29 18:20

Is there anything non-RESTful about providing parameters to a HTTP DELETE request?


My scenario is that I\'m modelling the \"Are you sure you want to delete t

4条回答
  •  离开以前
    2020-11-29 18:49

    It's an old question, but here are some comments...

    1. In SQL, the DELETE command accepts a parameter "CASCADE", which allows you to specify that dependent objects should also be deleted. This is an example of a DELETE parameter that makes sense, but 'man rm' could provide others. How would these cases possibly be implemented in REST/HTTP without a parameter?
    2. @Jan, it seems to be a well-established convention that the path part of the URL identifies a resource, whereas the querystring does not (at least not necessarily). Examples abound: getting the same resource but in a different format, getting specific fields of a resource, etc. If we consider the querystring as part of the resource identifier, it is impossible to have a concept of "different views of the same resource" without turning to non-RESTful mechanisms such as HTTP content negotiation (which can be undesirable for many reasons).

提交回复
热议问题