Tuesday, January 12, 2016

What is REST? What is RESTful API's

The REST stands for " REpresentational State Transfer".


  • Resource-based vs action-based in some other services systems
  • Representations that are pass back client server
  • Six Constrains : of restful architecture
    • Uniform interface
    • Stateless
    • Client server
    • Cacheability
    • Layed system
    • Code on demand
       The rest is Resource Based.
  • things vs actions
  • Nouns vs verbs
  • Versus SOAP-RPC
  • Indentified by URIs
    • Multiple URIs may refer to some resource
  • Separate from their representation(s)

                         Representations
  • How resources get manipulated
  • Part of the resource state
    • Transferred between client and server
  • Typical JSON or XML
Ex:
  • Resource : person 
  • Service    : Contact information (GET)
  • Representation :
    • name, address, phone number, email
    • JSON or XML format (Most commonly JSON format)
                                     Architectural Format
                            Uniform Interface
  • It defines the interface between client and server
  • simplifies and decouples the architecture
  • Fundamental to RESTful design
               this means:
      
                   HTTP verbs (GET,PUT,POST,DELETE)
                   URIs (resource name)
                   HTTP response (status, body)

                             Stateless
  • Server Contains no client state
  • Each request contains enough context to process the message
    • self-descriptive message
  • Any session state is held on the client
                              Server
  • we assume a disconnected system
  • separation of concerns
    • really defines what user interface and what services. 
  • Uniform interface is the link between the two
    • understanding that the restful client-server
                             Cacheable
  • Server responses (representations) are cacheable
  • Implicity
  • Explicity
  • Negotiated
                               Layered System
  • Client can't assume direct connection to server
  • software to hardware intermediaries between client and server
  • Improves scalability
                               Code on Demand
  • Server can temporarily extend client
  • Transfer  logic to client
  • Client executes logic
                        Ex:
                               Java applets
                               Java Script
  • The only optional constraint

Compliance with REST Constraints allows
  • Scalability
  • Visibility
  • Simplicity
  • Portability
  • Modifiability
  • Reliability