我对REST API的结构感到好奇:使用HTTP DELETE
方法而不有效地删除Web服务器目录上但数据库中的资源是否正确?
The RFC 7231 defines the semantics of the HTTP DELETE
method.
It expresses a deletion operation on the URI mapping (and it doesn't expect that the associated content will be actually deleted from the server). Whether the actual content will be deleted or not or whether it can be restored or not, is up to the server implementation.
See the quote below (highlights are mine):
The
DELETE
method requests that the origin server remove the association between the target resource and its current functionality. In effect, this method is similar to therm
command in UNIX: it expresses a deletion operation on the URI mapping of the origin server rather than an expectation that the previously associated information be deleted.If the target resource has one or more current representations, they might or might not be destroyed by the origin server, and the associated storage might or might not be reclaimed , depending entirely on the nature of the resource and its implementation by the origin server (which are beyond the scope of this specification). Likewise, other implementation aspects of a resource might need to be deactivated or archived as a result of a
DELETE
, such as database or gateway connections. In general, it is assumed that the origin server will only allowDELETE
on resources for which it has a prescribed mechanism for accomplishing the deletion. [...]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.