Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is REST (RESTful) web service tied to (is coupled to or requires) HTTP?

The title basically says it all, is REST really tied to HTTP or is it protocol independent? Because I've just read few articles about REST and I encountered both opinions so I don't know which one is correct.

like image 484
Petr Mensik Avatar asked Feb 14 '23 03:02

Petr Mensik


1 Answers

Allow me to quote the book "RESTful Web Services" (bold is mine):

The Story of the REST

REST is simple, but it’s well defined and not an excuse for implementing web services as half-assed web sites because “they’re the same.” Unfortunately, until now the main REST reference was chapter five of Roy Fielding’s 2000 Ph.D. dissertation, which is a good read for a Ph.D. dissertation, but leaves most of the real-world questions unanswered. That’s because it presents REST not as an architecture but as a way of judging architectures. The term “RESTful” is like the term “object-oriented.” A language, a framework, or an application may be designed in an object-oriented way, but that doesn’t make its architecture the object-oriented architecture. Even in object-oriented languages like C++ and Ruby, it’s possible to write programs that are not truly object-oriented. HTTP in the abstract does very well on the criteria of REST. (It ought to, since Fielding co-wrote the HTTP standard and wrote his dissertation to describe the architecture of the Web.) But real web sites, web applications, and web services often betray the principles of REST. (...)

Notice in the second bold, he's saying: "HTTP fits REST well", not "REST fits/depends on HTTP".

So, in short: no, the term "REST" is not necessarily tied to HTTP. RESTful web services are just web services that follow a RESTful architecture, hoping to achieve the benefits listed by Fielding in his thesis (such as statelessnes, addressability, etc.).

One way to create RESTful web services is to think of you application in terms of resources (not actions, as the SOAP style uses). Such way of thinking in conjunction with proper usage of HTTP (its methods and status codes) can lead to a REST-enabled architecture as (and with all the benefits) Fielding's thesis enumerates.

like image 71
acdcjunior Avatar answered Mar 22 '23 23:03

acdcjunior