REST系统和基于REST的系统之间的区别是什么?

从我读到的一些东西来看,所谓的REST服务实际上就是RESTful服务。那么两者之间的区别是什么呢?


当前回答

具象状态传输(Representational State Transfer, REST)是一种用于分布式超媒体系统(如万维网)的软件体系结构风格。2000年,罗伊·菲尔丁(Roy Fielding1[2])在他的博士论文中引入并定义了“具象状态转移”(Representational State Transfer)一词。Fielding是超文本传输协议(HTTP)规范1.0和1.1版本的主要作者之一。 遵循REST约束被称为“RESTful”。资料来源:维基百科

其他回答

“REST”是一种体系结构范式。“RESTful”描述了使用该范例。

把REST看作一个体系结构“类”,而RESTful是该类的众所周知的“实例”。

请注意“”;这里我们不是在处理“真正的”编程对象。

“REST服务”和“REST式服务”是一回事。

基于REST的系统是任何遵循原始文档中定义的REST约定的系统,该文档创建了基于REST的网络应用程序的思想。

值得注意的是,RESTfulness有不同的等级。总的来说,REST是一种风格,而不是标准,因此有根据需要进行解释的空间。一个例子是分层资源url(例如/things/ID/relatedthings) vs平面url(例如/things/ID和/relatedthings?thing=ID)

在Richardson成熟度模型中定义了4个级别的API。这些被定义为:

level 0: any system that has a single endpoint for all its apis(SOAP or RPC fall in this category). Level 0 apis can also resemble "commands". level 1: a ResourceUri described system. This is a system that defines multiple entity-based URIs (instead of having a single endpoint like a level 0 systems would). These URIs can use different http actions (POST, GET, PUT, etc) to implement different actions against that resource. level 2: aka level 1 w/ a compliant use of Standard HTTP methods/verbs and multi status code responses level 3: aka level 2 plus HATEOAS (hypermedia included in the response which describes additional calls you can make)

虽然级别1、级别2和级别3可以被认为是REST系统,但只有更严格的级别(即级别2和级别3)才被认为是RESTful的。

所以本质上所有的RESTful api都是REST api,但并不是所有的REST api都是RESTful的

理查德森成熟度模型的定义

REST stands for representational state transfer. That means that state itself is not transferred but a mere representation of it is. The most common example is a pure HTML server based app (no javascript). The browser knows nothing about the application itself but through links and resources, the server is able transfer the state of the application to the browser. Where a button would normally change a state variable (e.g. page open) in a regular windows application, in the browser you have a link that represents such a state change.

这个想法就是使用超媒体。也许还能创造出新的超媒体类型。我们可以用javascript/AJAX扩展浏览器,并创建新的自定义超媒体类型。这样我们就有了一个真正的REST应用程序。

This is my short version of what REST stands for, the problem is that it is hard to implement. I personally say RESTful, when I want to make reference to the REST principles but I know I am not really implementing the whole concept of REST. We don't really say SOAPful, because you either use SOAP or not. I think most people don't do REST the way it was envisioned by it's creator Roy Fielding, we actually implement RESTful or RESTlike architectures. You can see his dissertation, and you will find the REST acronym but not the word RESTful.