Java Reference
In-Depth Information
Other Tenets of REST
There are a number of related tenets that Fielding has identified on his website in recent years
to help clarify some of the complexity or abstraction of his doctoral dissertation. These in-
clude the following:
▪ A REST API should not be dependent on any single communication protocol.
▪ A REST API “should spend almost all of its descriptive effort in defining the media types
used for representing resources and driving application state.” Do this to ensure that hy-
pertext is actually the driver that transitions application state, and not out-of-band inform-
ation.
▪ A REST API must not define fixed resource names that are written in stone, as doing so
will lead to coupling of the client and server. Instead, you want to define the instructions
for constructing valid URIs through the media types and link relations. If you don't find
a way to do this, you'll ultimately end up with an API that looks and acts very much
like RPC, except that you're maybe using HTTP methods and doing lots of out-of-band
homegrown IDL work.
▪ A REST API should have an initial entry point URI that is stable (bookmarkable). From
that point, all state transitions must take place with the client choosing from among a set
of server-provided choices. Those choices must be present in the representations received
by the client. The set of transition possibilities can be narrowed down by something like
an Accept header, for example.
Advantages of REST
This architecture provides several benefits on the server side. These include the additional
ability to scale horizontally and an easy and clear mechanism for caching, as well as a simple
failover strategy. These benefits are directly inherited from building on the architecture of the
Web in its static form.
There are advantages to working with REST on the client side as well. These include the abil-
ity to cache and bookmark representations, and the flexibility to choose data formats that are
most appropriate for your use case.
REST Versus SOAP
As you may be aware, there is considerable debate among developers and architects on the
topic of REST versus SOAP. The following points seem most pertinent to me regarding the
importance of REST:
Search WWH ::




Custom Search