哪个 http verb/best 实践更新没有有效载荷发送的实体?

which http verb/best practice to update an entity without payload to send?

目的很简单: 我想修改实体,但我没有数据要在有效负载中发送,因为请求真的很简单。 事实上,我的 url 是这样的:

/v1/{customerId}/release/old/subscriptions

==> 请求 customerId 的代码更新实体订阅。

问题是: @GetMapping :好的,但不是 RESTFULL,因为实体已修改! @PutMapping:好的,但没有要发送的负载! @PostMapping:好的,但没有要发送的负载!

最佳做法是什么?

我想做一些

which http verb/best practice to update an entity without payload to send?

一般规则是您使用 POST 除非您的消息的语义匹配更具体的方法。

PUT 具有空负载是请求使资源的当前表示为零字节长。认为“删除文件的内容”。

PATCH 请求应该在负载中包含一个补丁文档;因此,无论该特定媒体类型的空文档的含义如何,其含义都是如此。我想我从来没有听说过一个空的补丁文档会做一些有趣的事情。

POST requests are intended for any semantic that isn't worth standardizing.