PUT,POST和PATCH有什么区别? [英] What is the difference between PUT, POST and PATCH?

查看:281
本文介绍了PUT,POST和PATCH有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTTP协议中的PUT,POST和PATCH方法有什么区别?

What is the difference between PUT, POST and PATCH methods in HTTP protocol?

推荐答案

POST

$ b当客户端向服务器发送数据并且服务器将决定新创建的资源的URI时,可以使用
$ b

HTTP.POST 。 POST方法用于请求源服务器接受请求中包含的实体作为请求行中Request-URI标识的资源的新下级。

POST

HTTP.POST can be used when the client is sending data to the server and the server will decide the URI for the newly created resource. The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.

HTTP.PUT 可在客户端向服务器发送数据且客户端为确定新创建的资源的URI。 PUT方法请求将所包含的实体存储在提供的Request-URI下。如果Request-URI引用已经存在的资源,则封闭的实体应该被视为驻留在源服务器上的实体的修改版本。如果Request-URI未指向现有资源,并且该URI能够被请求用户代理定义为新资源,则源服务器可以使用该URI创建资源。

HTTP.PUT can be used when the client is sending data to the server and the client is determining the URI for the newly created resource. The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

当客户端发送一个或多个时,可以使用HTTP.PATCH 服务器应用的更改。 PATCH方法请求将请求实体中描述的一组更改应用于Request-URI标识的资源。这组更改以称为补丁文档的格式表示。

HTTP.PATCH can be used when the client is sending one or more changes to be applied by the server. The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI. The set of changes is represented in a format called a patch document.

这篇关于PUT,POST和PATCH有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆