675

What's the difference between a REST system and a system that is RESTful?

From a few things I've read most so called REST services are actually RESTful services. So what is the difference between the two.

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
  • 3
    The reason for the question is because if you read the article in the link and look up what Dr Fielding thinks about most REST implementations they aren't REST systems at all. They exhibit RESTful behaviour but can't be classed as REST systems. – AwkwardCoder Oct 14 '09 at 20:45
  • 5
    I read the article but I don't think it led to him to such semantically useless distinctions. – JasonTrue Oct 14 '09 at 20:50
  • 7
    Wikipedia article on REST - http://en.wikipedia.org/wiki/Representational_State_Transfer - second paragraph - "Conforming to the REST constraints is often referred to as being ‘RESTful’." – Nate Oct 15 '09 at 03:09
  • 1
    @PramodNikumbh has this answered correctly below. A "REST" system is a system that fits a broader definition of REST. It exhibits at least some rest principles. "Restful" describes a much more REST-compliant system. – Andrew Norman Jan 19 '18 at 00:05
  • 1
    Well, I think there is a confusion in the name, the "ful" in RESTful will confuse stateless and stateful and those are two different things, REST and RESTful in my personal opinion, have to be STATELESS. imagine a stateful REST named RESTles. :) – Waheed Mar 05 '19 at 09:56
  • REST web service is used by Service provider and service consumer Eg : Consider you are booking/buying a movie ticket – Yash Chitroda May 06 '21 at 11:36

16 Answers16

582

Representational state transfer (REST) is a style of software architecture. As described in a dissertation by Roy Fielding, REST is an "architectural style" that basically exploits the existing technology and protocols of the Web.

RESTful is typically used to refer to web services implementing such an architecture.

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
  • 184
    So REST is the architecture and RESTful an adjective? – manei_cc May 19 '14 at 21:07
  • 7
    @manei_cc: Although in practice what you will find is services named RESTful that don't follow the REST architecture and are basically REST-like, REST-wannabies etc. So always pay attention that a "RESTful service" is not necessarily built using REST architecture, but true as Justin Ethier wrote: _exploits the existing technology and protocols of the Web_. – Azder Jul 05 '14 at 07:59
  • 13
    RESTful should be used for APIs whose really respect REST. I saw too many "REST" webservices which only used GET or POST. RESTful accentuate on the complete use of HTTP verbs, and URL naming conventions. But it's my point of view. – Martin Jan 08 '15 at 09:24
  • 2
    `architect` of what? of urls? like `https://translation.googleapis.com/language/translate/v2` this is the REST style? – Asif Mushtaq Jul 07 '17 at 16:48
  • RESTful took simple and straightforward features from the Level 2 maturity model by Leonard Richardson of the classic REST by Roy Fielding. https://www.c-sharpcorner.com/article/restful-vs-rest-api-or-where-rest-came-from/ – Commander Nov 01 '21 at 22:16
361

REST based Services/Architecture vs. RESTFUL Services/Architecture

To differentiate or compare these 2, you should know what REST is.

REST (REpresentational State Transfer) is basically an architectural style of development having some principles:

  • It should be stateless

  • It should access all the resources from the server using only URI

  • It does not have inbuilt encryption

  • It does not have session

  • It uses one and only one protocol - HTTP

  • For performing CRUD operations, it should use HTTP verbs such as get, post, put and delete

  • It should return the result only in the form of JSON or XML, atom, OData etc. (lightweight data )

REST based services follow some of the above principles and not all

RESTFUL services means it follows all the above principles.

It is similar to the concept of:

Object oriented languages support all the OOP concepts, examples: C++, C#

Object-based languages support some of the OOP features, examples: JavaScript, VB


Example:

ASP Dot NET MVC 4 is REST-Based while Microsoft WEB API is RESTFul.

MVC supports only some of the above REST principles whereas WEB API supports all the above REST Principles.

MVC only supports the following from the REST API

  • We can access the resource using URI

  • It supports the HTTP verb to access the resource from server

  • It can return the results in the form of JSON, XML, that is the HTTPResponse.

However, at the same time in MVC

  • We can use the session

  • We can make it stateful

  • We can return video or image from the controller action method which basically violates the REST principles

That is why MVC is REST-Based whereas WEB API supports all the above principles and is RESTFul.

slow-but-steady
  • 961
  • 9
  • 15
Pramod Nikumbh
  • 3,729
  • 1
  • 11
  • 3
  • 23
    I don't understand why this has been downvoted, this answer brings lots of clarifying information to the question. – Marcovecchio Feb 25 '16 at 13:44
  • 10
    best answer so far – Limon Oct 07 '16 at 14:04
  • 4
    This the best answer. – Mário Meyrelles Nov 08 '16 at 16:09
  • your answer is easy to understand. – Waqas Ahmed Jun 20 '17 at 16:00
  • 3
    you can use FTP with REST. please see: https://stackoverflow.com/questions/35534812/can-rest-be-implemented-over-ftp – crazyTech Apr 07 '18 at 18:42
  • easy and described in a manner that a newbie can also understand. – amit pandya Jun 08 '18 at 15:55
  • The Jan 4 edit to this answer made it contradict itself. The original text was "But at the same time in MVC" which makes sense to explain why MVC is not fully RESTful. – Ray Slater Aug 09 '18 at 07:43
  • 12
    Languages under "Object based" and "Object Oriented" categories above are reversed. Object Oriented languages follow all OOPS principles, while Object Based ones follow some. – Mrchief Aug 29 '18 at 13:44
  • Object based is partial subset of Object oriented. And I think you have interchanged the examples of Object based and Object Oriented. C# identifies itself and regarded as Object Oriented, VB (not VB.NET) is Object based. – Bhanu Chhabra Oct 06 '18 at 05:39
  • 1
    Downvoted: I don't think this is correct. Which authoritative resource are you using to make this claim? Please refer to it. I've come across some people using this distinction. I'm guessing it comes from non-native English speakers who confuse the -ful suffix, which turns 'REST' into an adjective (which is pretty much what all the other answers here are saying), with meaning 'fully', 'complete'. – Vincent Sels Apr 15 '19 at 15:07
  • "...it should use HTTP verbs such as get, post, put and delete..." this item may confuse, at first sight its look like URL should be: ..../getUser... .../deleteUser... It should use HTTP methods GET POST PUT PATCH DELETE instead 'verbs' – Kaiser Aug 13 '19 at 14:18
  • 1
    This helps me to understand REST for sure, but I also found that "REST is not coupled to HTTP": https://stackoverflow.com/questions/7428163/other-rest-implementations-than-http AND @crazyTech is also mentioned above – James Yoo Apr 16 '20 at 23:14
  • I logged in to UP vote this answer. Nice description! – Ihor Jan 29 '21 at 20:32
  • 2
    This is very wrong. `REST based` services are not thing: they are either REST or they aren't. And `RESTful` most certainly does not refer to meeting all of the criteria, that's what REST is. `RESTful` is a term that is not used in the original thesis, and it's not really known how it came to be; mostly, it's used as an adjective for a service that meets the REST criteria, but that definition is unofficial at best. We don't say `SOAPful`. Also, I don't know about C#, but C++ most certainly does not support all OOP concepts. Far from it. In fact, the original inventor of the OOP concept has – André Fratelli Feb 06 '21 at 21:42
  • 1
    stated before that when he thought of OOP he did not have C++ in mind. Example: C++ does not support inspection. Another gross mistake is trying to relate MVC and REST, when the two concepts are widely unrelated. You can have MVC in a program that isn't even a web service and only performs local calls. MVC is not a web concept, REST is. The abuse of terminology continues further by somehow relating sessions with MVC, a software design paradigm. I'm surprised that this post is getting so many upvotes, they are most certainly not deserved. – André Fratelli Feb 06 '21 at 21:45
  • REST architecture style doesn't promotes only HTTP usage, it just restricts it under using of stateless protocol. Session terminology also relates to a protocol, not to a REST in general. And the most confusing thing is your thesis about CRUD operations.This is completely wrong. CRUD indented to be purely an imdepotent, that's why POST isn't possible to use nor for creates, nor for updates. Only PUT, GET, DELETE – Alex-Bogdanov Mar 10 '21 at 17:37
  • This answer missed the point of REST. It does not emphasizes the core concept of hypermedia and the necessary absence of contract (such as swagger). A REST interface can only be discovered at runtime, never using swagger or other contract established at compilation time. – The Impaler May 25 '21 at 14:34
  • [Wikipedia](https://en.wikipedia.org/wiki/Representational_state_transfer#Discussion) seems to think this answer has the `restful` and `rest` backwards. Just like @AndréFratelli said before. But @PramodNikumbh definitely has a lot of friends. – Arturo Hernandez Nov 01 '21 at 22:53
  • very easy and simple explaination – SHEKHAR SHETE Nov 24 '22 at 06:21
  • Does anyone know where did the original concept of `RESTful` come from? Roy uses `RESTful` but didn't clarify it [here](https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven). But still I guess @AndréFratelli is correct. Or else, is it just an adjective form of `REST`? – Seiwon Park Apr 27 '23 at 06:44
137

"REST" is an architectural paradigm. "RESTful" describes using that paradigm.

SingleShot
  • 18,821
  • 13
  • 71
  • 101
  • 4
    A REST architecture requires many traits. You cannot say something adheres to REST principles by merely showing a URL. – SingleShot Jul 08 '17 at 21:12
43

As Jason said in the comments, RESTful is just used as an adjective describing something that respects the REST constraints.

Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
37

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.

The idea is to use hypermedia. And perhaps to create new hypermedia types. Potentially we can expand the browser with javascript/AJAX and create new custom hypermedia types. And we would have a true REST application.

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.

Arturo Hernandez
  • 2,749
  • 3
  • 28
  • 36
25

REST is an style of software architecture for distributed software

Conforming to the REST constraints is referred to as being ‘RESTful’.

Very used today to build web services as an alternative to SOAP.

Here you have some links to check

http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.computerworld.com/s/article/297424/Representational_State_Transfer_REST_
http://www.ibm.com/developerworks/webservices/library/ws-restful/

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
14

thanks for the answers. Read this article by Alex Rodriguez which suggests that a RESTful web service has 4 basic characteristics which are:

  1. Use HTTP methods explicitly.
  2. Be stateless.
  3. Expose directory structure-like URIs.
  4. Transfer XML, JavaScript Object Notation (JSON), or both.
drac_o
  • 427
  • 5
  • 11
Kumait
  • 702
  • 8
  • 15
11

Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding1[2] in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1. Conforming to the REST constraints is referred to as being ‘RESTful’. Source:Wikipedia

Andersson Melo
  • 764
  • 1
  • 13
  • 32
8

Web services are essentially web sites whose content is consumed by computer programs, not people. REST is a set of architectural principles that stipulate that web services should maximally leverage HTTP and other web standards, so that programs gain all the good stuff that people already can get out of the web. REST is often contrasted with SOAP web services, and other "remote procedure call" oriented web services.

Stefan Tilkov's presentations on REST at Parleys.com are quite good, especially this one.

For a book, you can't get any better than Richardson and Ruby's Restful Web Services.

Jim Ferrans
  • 30,582
  • 12
  • 56
  • 83
  • So a regular website can be considered a REST application? – yoyo_fun Apr 29 '16 at 23:14
  • 1
    @yoyo_fun: Yes, a regular website can be constructed RESTfully too. At some level of abstraction whether the server returns HTML to a human or JSON (say) to a program is immaterial. – Jim Ferrans Sep 24 '16 at 23:46
7

A service based on REST is called a "RESTful service".

Source I rely on posting that: Dr.Dobbs Archive

nickolay
  • 3,643
  • 3
  • 32
  • 40
7

There are 4 levels of API defined in the Richardson Maturity Model. These are defined as:

  • 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)

While levels 1, level 2, and level 3 can be considered as REST systems, only the stricter levels (aka level 2 and level 3) are considered to be RESTful.

So essentially all RESTful apis are REST apis, but not all REST apis are RESTful

definition of the Richardson Maturity Model

Andrew Norman
  • 843
  • 9
  • 22
3

Coming at it from the perspective of an object oriented programming mindset, REST is analogous to the interface to be implemented, and a RESTfull service is analogous to the actual implementation of the REST "interface".

REST just defines a set of rules that says what it is to be a REST api, and a RESTfull service follows those rules.

Allot of answers above already laid out most of those rules, but I know one of the big things that is required, and in my experience often overlooked, as that a true REST api has to be hyperlink driven, in addition to all of the HTTP PUT, POST, GET, DELETE jazz.

DudeGuy
  • 129
  • 2
  • 7
2

A "REST service" and a "RESTful service" are one and the same.

A RESTful system is any system that follows the REST conventions as defined in the original document that created the idea of RESTful networked applications.

It's worth noting there are varying levels of RESTfulness. Overall, REST is a style, not a standard, so there is room for interpretation based on needs. one example is hierarchical resource URLs (e.g. /things/ID/relatedthings) vs flat URLs (e.g. /things/ID and /relatedthings?thing=ID)

Brenden
  • 7,708
  • 11
  • 61
  • 75
2

Think of REST as an architectural "class" while RESTful is the well known "instance" of that class.

Please mind the ""; we are not dealing with "real" programming objects here.

Pat
  • 2,670
  • 18
  • 27
2

REST(REpresentation State Transfer) is an architecture using which WebServices are created.

and

RESTful is way of writing services using the REST architectures. RESTful services exposes the resources to identify the targets to interact with clients.

Manas
  • 59
  • 1
1

REST is an architectural pattern for creating web services. A RESTful service is one that implements that pattern.

sajadre
  • 1,141
  • 2
  • 15
  • 30