Representational State Transfer

REST (Representational State Transfer) is an architecture style for designing network applications. It was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation. Unlike complex mechanisms (For example, Remote Procedure Calls (RPC) where the calling arguments are passed to the remote procedure and the caller waits for a response to be returned from the remote procedure), it uses HTTP to connect between machines.
HTTP is the underlying protocol of World Wide Web. It defines how messages are formatted and transmitted, and what actions web servers and browsers should take in response to various commands.

  • HTTP is stateless, i.e each command executed independently, without any knowledge of the commands that came before it.
  • HTTP is client-server protocol, which treats this two part separately. Client sends request to Web server, which is responsible for document storage and retrieval, it sends the information back.
  • HTTP is cachable, i.e. it allows the client side to cache information and has specifications for when a response can be cached. In this protocol caching is desirable so it’s explicitly designed for it.
RESTful example
RESTful example

RESTful applications use HTTP requests to post data (create and update), read data (make queries) and delete data.
Key components of REST architecture:

  • Resources – identified by URLs
  • A web of resources – a single resource should not be too large and contain too fine-grained details. Instead, the resource should contain links to additional information.
  • Client-server, where one component’s server can be another component’s client
  • No connection state, each request must carry all information required to complete it, and must not rely on previous interactions with client
  • Resources should be cachable when possible, to allow server to specify which resources may be cached and for how long HTTP cache-control headers are used.
  • Proxy servers (intermediary servers) can be used to improve performance.