Representational State Transfer


History


  • REST is architectural style developed in parallel to the HTTP/1.1 protocol
  • The largest known implementation of a system conforming to the REST architectural style is the Web
  • It is possible to design a software system in accordance with Fielding's REST architectural style without using HTTP and without interacting with the World Wide Web


REST in short



  • REST is more like style of programming
  • Best example of REST is RSS
  • REST is KISS
  • Why Representational State Transfer?
    • If user go to www.milosev.com
      • he will get the web page (Representational)
      • browser will change his page (State)
      • if user click on a link he will change (Transfer) browser state


Concept


  • Consists of clients and servers
  • It doesn't use resources on a network or server
    • example: web page, user can use web page, without sending messages to the server
  • Client sends messaged to the server only when it goes to new state


Constraints


  • Client - server
    • clients are not concerned with data storage
    • servers are not concerned with the user interface or user state
  • Stateless
    • each request from any client contains all of the information necessary to service the request, and any state is held in the client
  • Cacheable
    • well-managed caching partially and completely eliminates some client-server interactions, further improving scalability and performance
  • Uniform interface
    • simplifies and decouples the architecture
    • principles:
      • individual resources are identified in requests
      • manipulation of resources through these representations
      • self descriptive messages
      • hypermedia as the engine of application state
  • Layered system
    • a client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way
  • Code on demand (optional)
    • Servers are able to transfer logic to the client that it can execute (example: JavaScript)


Resources


  • An important concept in REST is the existence of resources
  • Client doesn't know is there cache, proxy, firewall, or anything else between client or server
  • Client must know format of the information which is back


References