RESTful API – Is It Possible to Implement with Protocols Other Than HTTP(S)?

apiinternetprotocolrestweb

I was confused by the distinction between REST and HTTP, and I found this article that cleared things up for me. In summary, it explained that REST is a set of general principles for web communication, whereas HTTP is a specific application-layer internet protocol. The article pointed out that HTTP lends itself to following REST principles, but there are plenty of examples where applications violate REST while using HTTP.

Although I don't think the article explicitly said it, I inferred that because REST is a style rather than a protocol, you could follow REST principles with any number of protocols other than HTTP.

However, I am not aware of any REST apis that don't use HTTP. I'm also not very familiar with any of the other application-layer protocols, so I don't know whether any of them follow the principles of REST. And it is my impression that in everyday conversation, saying "a REST API" implies HTTP, because HTTP dominates the web.

Can other protocols be used for REST apis?

Best Answer

Can other protocols be used for REST apis?

Hypothetically? Yes. REST is an architectural style, anybody can use those constraints to build something new.

In practice? We've already got a world wide web (which is the problem that the REST architectural style is aligned with), and a standard for "self-describing messages", which is itself extensible, and we've already managed to standardize HTTP/2 as a successor to HTTP/1, and have made progress on HTTP/3 as a successor to HTTP/2.

So you probably aren't going to see the introduction of another "web scale" application based on REST, unless someone comes up with something that is significantly better than the web-as-it-is.

Related Topic