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的含义;如 Emil Ivanov 备注,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 应使用的方式。
今天我们只使用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屋!