introduction to rest

11
REST Introduction KUMAR GAURAV [email protected]

Upload: kumar-gaurav

Post on 26-Jan-2017

420 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Introduction to REST

REST Introduction

KUMAR [email protected]

Page 2: Introduction to REST

Agenda REST Concept REST Constrains REST Data Elements REST V.S. SOAP REST V.S. SOA How to be RESTful Q&A

Page 3: Introduction to REST

REST ConceptREST is

Representational State Transfer between Resourcebetween Resource

A style of software architecture

A Virtual state-machineA network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.  

Page 4: Introduction to REST

• Client-Server• Separation principle• Components Independent

• Stateless• Session state on the client• Visibility, reliability and scalability• Trade off (network performance, etc.)

• Cacheable• A response can be cacheable• Efficiency but reduce reliability

• Layered system• System scalability

• Code on demand (optional)• Extension after deployment

• Uniform Interface• Simple

REST Constraints

Page 5: Introduction to REST

• Resources and Resource Identifiers• Uniform Interface (GET, PUT, POST, DELETE)• Resource Oriented• Simple and simple is beautiful

REST Data Elements

HTTP Method CRUD Desc.POST CREATE Create -GET RETRIEVE Retrieve Safe,Idempotent,Cacheable

PUT UPDATE Update Idempotent

DELETE DELETE Delete Idempotent

Page 6: Introduction to REST

Representations• HTML / XML / images / sounds / …

REST Data Elements

Page 7: Introduction to REST

SOAP • Simple Object Access Protocol

• RPC protocol that go through firewalls

• Communication protocol between applications

• A format for sending messages

REST V.S. SOAP

Page 8: Introduction to REST

REST•“The Web is the universe of globally accessible information”• Resource oriented• User-driven interactions via forms• Few operations (generic interface) on many resources• URI: Consistent naming mechanism for resources• Focus on scalability and performance of large scale distributed hypermedia systems

SOAP•“The Web is the universal transport for messages”• Activity/Service oriented• Orchestrated reliable event flows• Many operations (service interface) on few resources• Lack of standard naming mechanism• Focus on design of integrated (distributed) applications

REST V.S. SOAP

Page 9: Introduction to REST

Two of most common styles of use of Web Services•Service-oriented architecture

• “Message oriented” (SOAP)• Contract provided by WSDL

•REST• Focus on interacting with stateful resources, rather than messages or operations.

REST V.S. SOA

Page 10: Introduction to REST

REST V.S. SOA

Correlation • REST is an architectural style that inherently helps to attain some of the basic SOA principles.

SOA principles •Standardized Service Contracts•Service Loose Coupling•Service Abstraction•Service Reusability•Service Autonomy•Service Statelessness•Service Discoverability•Service Composability

REST principles •Unique identifiability of the resources through URIs•Uniform interface to access the resources•Navigability of the resource representations through hypermedia •Statelessness

Page 11: Introduction to REST

Thank you!

REST Introduction