Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Must a RESTful service always be based on HTTP?

Tags:

rest

http

Lots of websites (e.g. twitter, stackexchange) provide RESTful OPEN APIs based on the HTTP protocol. Can I design a RESTful service based on some other protocol (such as raw TCP)?

like image 549
tidy Avatar asked Mar 04 '13 03:03

tidy


People also ask

Does REST API always use HTTP?

REST APIs add no new capability to HTTP APIs. But it is an architectural style that was created in tandem with HTTP and most typically employs HTTP as its application layer protocol. However, REST isn't always linked to HTTP. You can use other transfer protocols, such as FTP, SMTP, etc.

Is HTTP mandatory to be used by REST?

REST is not necessarily tied to HTTP. RESTful web services are just web services that follow a RESTful architecture. HTTP is a contract, a communication protocol and REST is a concept, an architectural style which may use HTTP, FTP or other communication protocols but is widely used with HTTP.

What are the requirements for a RESTful service?

In order for an API to be considered RESTful, it has to conform to these criteria: A client-server architecture made up of clients, servers, and resources, with requests managed through HTTP.

Why RESTful web services use HTTP as the protocol?

REST is web standards based architecture and uses HTTP Protocol. It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods.


1 Answers

If you look at Roy Fielding's PhD thesis, you'll see that REST is defined in chapter 5, while it's applied to HTTP in chapter 6.

"Representational state transfer" is indeed quite abstract. There's no reason you couldn't apply it to your own adhoc protocol. The aim is to make it stateless, to have safe read methods (that are cacheable), and if possible idempotent write methods.

like image 107
Aurélien Avatar answered Oct 01 '22 23:10

Aurélien