What is the relationship between HTTP and Rest?

Viewed 71

When I cameup by checking the articles about rest almost all everyone are saying that we need to use HTTP for REST but what is the relationship between HTTP and REST so REST is only for HTTP?

2 Answers

First and foremost thing we need to understand that HTTP is the best fit for Roy Fielding's REST constraints.

HTTP is just a protocol which is used to transfer data over the web, and you can find an alternative of HTTP and check whether it is obeying Roy Fielding's REST constraints or not

BUT

Remember one thing, it should obey 5 constraints of REST out of 6 (at least) because Code on demand is an optional constraint (so your alternative protocol should be able to follow 6-1 = 5 constraints of REST at least)

So finally, it's not just a friend of HTTP you can use any protocol, but it should be able to obey five constraints of REST.

What is the relationship between HTTP and Rest?

RFC 2616: Roy Fielding was the head of the HTTP/1.1 standards effort. REST is the tool he developed to help guide the discussion of the standard.

the motivation for developing REST was to create an architectural model for how the Web should work, such that it could serve as the guiding framework for the Web protocol standards. (Fielding, 2000)

As for why we need HTTP to do REST: we don't. We could instead start over, and apply the REST architectural constraints to create a new protocol.

But that's an enormous amount of work. That amount of work was worth doing once - the world wide web was catastrophically successful.

Is it worth doing that work a second time to produce an alternative to HTTP? My guess is that you would need an alternative that's about 10x better in order to achieve the critical mass that you would need to end up with an enduring solution.

Until that happens, it's a lot less effort to work with what is already available (HTTP).

Related