了解 REST 中的 HTTP DELETE 方法 API

Understanding HTTP DELETE method in a REST API

我想知道 REST API 结构:使用 HTTP DELETE 方法而不有效删除网络服务器目录上但在数据库中的资源是否正确?

RFC 7231 定义了 HTTP DELETE 方法的语义。

表示对URI映射的删除操作(并不期望关联的内容会真正从服务器上删除)。实际内容是否删除或恢复,由服务器实现。

请参阅下面的引用(重点是我的):

4.3.5. DELETE

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 the rm 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 allow DELETE on resources for which it has a prescribed mechanism for accomplishing the deletion. [...]