REST and HTTP are the same thing?

11

I'd like to know the difference between REST and HTTP. For a while, I've been studying these two subjects and they seem to me to be the same thing.

    
asked by anonymous 01.11.2015 / 20:20

2 answers

13

REST and HTTP are the same thing?

No, they are not.

HTTP

HTTP means H T T ransfer P rotocol is the most popular path to the transfer of data between computers. This protocol is used to connect hypertext pages in what we call world-wide-web (WWW). However, there are also other data transfer protocols available, such as FTP and gopher , even though they are less popular.

In practice it works like this: when you enter an address in the browser, it needs to send something somewhere saying that you want to read something. Imagine that you entered the Google address. Your browser prepares a letter, that's right, literally a letter to the server where the Google site is. In this letter is where the request exists with the HTTP methods.

REST

REpresentationalStateTransfer,orREST,isasetofrulesthatguaranteeascalable,easilyextensibleandfaulttolerant.Theworld-wide-webisanexampleofthistypeofsystem(andthegreatestpossibleexample).RESTbyitself,isnotanewinvention,butit'sthedocumentationforsystemsliketheworld-wide-web.

OnethingthatconfusesalotofpeopleisthatRESTandHTTPareprettymuchlinked.Andnotbychance,theworld-wide-webrunsontheHTTPprotocol,andaRESTfulAPIisalsobasedonthatsameprotocol.But,thereisnothingintherulesofRESTthatsaysthattheHTTPprotocolisstrictlymandatory.ItisperfectlyacceptabletouseanotherprotocolsuchasSNMP,SMTPorothers,andyourAPImaystillbeaRESTfulAPI.

Conclusion

In practice, most - if not all - RESTful APIs use HTTP as their communication protocol. Since infrastructure, servers and client libraries are highly available for this communication protocol. REST is based on an architectural style that consists of a coordinated set of architectural constraints applied to components, connectors, and data elements within a distributed hypermedia system. HTTP is the main protocol for data transfer in this architectural style.

    
01.11.2015 / 20:39
2

REST is a communication protocol, based on the HTTP hypermedia protocol . However, 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 system messages according to their specific need. The most common formals are Json, XML and plain text, but in theory any format can be used.

This brings us to another advantage: Web Services that use REST are often "lighter" and therefore faster.

The problem with REST can arise precisely because of its advantages. Because the definition of the data body is entirely the responsibility of the developer, interoperability issues are more common.

  

Source: Type Differences Web Service: SOAP, REST, XML

    
01.11.2015 / 20:40