11
I would like to know the difference between REST and HTTP. Since a while, I have been studying these two subjects and they seem to me to be the same thing.
11
I would like to know the difference between REST and HTTP. Since a while, I have been studying these two subjects and they seem to me to be the same thing.
14
REST
and HTTP
are the same thing?No, they’re not.
HTTP
HTTP
means HyperText Transfer Protocol and is the most popular path for data transfer between computers. This protocol is used to connect hypertext pages in what we call the world-wide-web (WWW). However, there are also other available data transfer protocols such as FTP
and the gopher
, even if they are less popular.
In practice it works like this: when you type an address in the browser, it needs to send something somewhere saying that you want to read something. Imagine you typed in the Google address. Your browser prepares a letter, that’s right, literally a letter to the server where the Google site is located. In this letter is where the requisition with the methods HTTP
.
REST
REpresentational STate Transfer, or REST
, is a set of rules that ensure a scalable, easily extensible and fault-tolerant system. A world-wide-web is an example of this type of system (and the greatest possible example). REST
by itself, it is not a new invention, but it is the documentation for systems like the world-wide-web.
One thing that confuses people a lot is that REST
and HTTP
are quite attached. And not by chance, the world-wide-web runs on the protocol HTTP
, and a Restful API is also based on that same protocol. But, there is nothing in the rules of REST
that says the use of the protocol HTTP
is strictly mandatory. It is perfectly acceptable to use another protocol such as SNMP
, SMTP
or others, and your API may still be a Restful API.
In practice, most - if not all - Restful Apis use the HTTP
as your communication protocol. Since infrastructure, Servers and client libraries are highly available for this communication protocol. The REST
is based on an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors and data elements within a distributed hypermedia system. The HTTP
is the main protocol for data transfer in this architectural style.
Very well explained +1..
3
REST is a communication protocol, based on the HTTP hypermedia protocol. But it does not impose restrictions on the format of the message, only on the behavior of the components involved.
The biggest advantage of the REST protocol is its flexibility. The developer can choose the most suitable format for the system messages according to their specific need. The most common forms are Json, XML and plain text, but in theory any format can be used.
This leads us to another advantage: almost always web services that use REST are more "lightweight" and therefore faster.
The problem with REST may arise precisely because of its advantages. As the definition of the data body is entirely up to the developer, interoperability problems are more common.
Browser other questions tagged rest http software-architecture
You are not signed in. Login or sign up in order to post.
I’m kind of running out of time to formulate a response, but I’ll give you a brief explanation, HTTP is a protocol and REST uses it, so it’s not the same thing. Any web page you access comes via HTTP, but does not come in REST - Related: http://answall.com/a/45787/3635
– Guilherme Nascimento