PUT/PATCH/POST

https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH

PATCH更新部分资源,非幂等(不必幂等)。
PUT更新整个资源,幂等(多次请求结果一样)。
POST非幂等,可能会有额外作用,比如多次操作可能会新增多个资源或修改多次资源。

The HTTP PATCH request method applies partial modifications to a resource.
A PATCH request is considered a set of instructions on how to modify a resource. Contrast this with PUT; which is a complete representation of a resource.
A PATCH is not necessarily idempotent, although it can be. Contrast this with PUT; which is always idempotent. The word "idempotent" means that any number of repeated, identical requests will leave the resource in the same state.

The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload.
The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), whereas successive identical POST requests may have additional effects, akin to placing an order several times.

The HTTP POST method sends data to the server.

你可能感兴趣的:(PUT/PATCH/POST)