HTTP 和 REST 有什么区别? [英] What is the difference between HTTP and REST?
问题描述
在阅读了大量有关 REST 和 SOAP 之间差异的信息后,我的印象是 REST 只是 HTTP 的另一个词.有人能解释一下 REST 为 HTTP 添加了哪些功能吗?
After reading a lot about the differences between REST and SOAP, I got the impression that REST is just another word for HTTP. Can someone explain what functionality REST adds to HTTP?
注意:我不是在寻找 REST 与 SOAP 的比较.
Note: I'm not looking for a comparison of REST versus SOAP.
更新:感谢您的回答.现在我已经很清楚 REST 只是关于如何使用 HTTP 的一组规则.因此我发布了关于 这些约定的优点是什么 .
Update: Thanks for your answers. Now it has become clear to me that REST is just a set of rules about how to use HTTP. Hence I posted a follow-up about what the advantages of these conventions are .
注意:我现在掌握了REST的含义;如 埃米尔·伊万诺夫 备注,REST 意味着按其应有的方式使用 HTTP.但是,我不确定这是否值得拥有一个自己的术语,而且我当然不会对其进行大肆宣传.
Note: I now grasp the meaning of REST; as Emil Ivanov remarks, REST means using HTTP the way it's meant to be. However, I'm not sure whether this deserves a term of its own, and I certainly don't get the hype around it.
推荐答案
不,REST 是 HTTP 应该使用的方式.
No, REST is the way HTTP should be used.
今天我们只使用了一小部分 HTTP 协议的方法——即 GET
和 POST
.REST 方法是使用协议的所有方法.
Today we only use a tiny bit of the HTTP protocol's methods – namely GET
and POST
. The REST way to do it is to use all of the protocol's methods.
例如,REST 规定使用 DELETE
擦除 URI 后面的文档(无论是文件、状态等),而使用 HTTP,您会误用 GET
或 POST
查询,如 ...product/?delete_id=22
.
For example, REST dictates the usage of DELETE
to erase a document (be it a file, state, etc.) behind a URI, whereas, with HTTP, you would misuse a GET
or POST
query like ...product/?delete_id=22
.
这篇关于HTTP 和 REST 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!