0

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?

4

2 Answers 2

3

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.

0

There probably are protocols other than REST that have already been using REST, you just need to look at environments that have the same limitations that REST tried to solve, i.e "slow", high latency, distributed network. Slow is relative, e.g. memory access in computer is slow and that's why they have caches, like REST.

On the other hand, the internet is not "slow and has high latency" anymore like how it was back then, that's why we find REST not being followed and people just write HTTP APIs.

Yet, some developers are used to REST, sometimes it's being used in environments that don't need it. For example, I have seen REST is being followed in communication using Kafka messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.