SlideShare a Scribd company logo
1 of 49
Download to read offline
On being RESTful
    Fabio Mancinelli
     fm@fabiomancinelli
What is this talk about?

An introduction to the REST architectural style...

          A different way of looking at
          Service Oriented Computing
What is this talk about?

An introduction to the REST architectural style...

          A different way of looking at
          Service Oriented Computing


         ...and some ideas to foster discussion for
             finding new research directions! ☺
A RESTless world
Also known as “Service Oriented
         Architecture”
Classic SOA

                               Service
•   Web-services               broker

•   WSDL
                    Register                Search

•   SOAP

•   UDDI            Service
                   provider     Request
                                           Service
                                          requester
Classic SOA

                                             Service
•   Web-services                             broker
                                                UDDI


•   WSDL
                    Register     WSDL                   WSDL     Search

•   SOAP

•                   Service                                     Service
                                                SOAP
    UDDI
                   provider                   Request          requester
                               Web Service
Web(?) services
“Definition: A Web service is a software system
designed to support interoperable machine-to-machine
interaction over a network. It has an interface
described in a machine-processable format (specifically
WSDL). Other systems interact with the Web service
in a manner prescribed by its description using SOAP
messages, typically conveyed using HTTP with an XML
serialization in conjunction with other Web-related
standards.”

                        [W3C, http://www.w3.org/TR/ws-arch/#whatis]
WSDL




XML description of the service interface
SOAP

• Was “Simple Object Access Protocol”,
  sometimes referred as SOA-Protocol
• Simply an XML-based messaging protocol
  used mainly as an RPC protocol
UDDI

• Universal Description, Discovery and
  Integration
• Platform-independent, XML-based registry
  for business services
• Accessible via SOAP, provides WSDLs
  (... and other complementary information)
The WS-* hell
•   WS-Policy             •   WS-Transfer            •   WS-Federation
                                                         Passive Requestor
•   WS-PolicyAssertions   •   WS-I Basic Profile          Profile

•   WS-PolicyAttachment   •   WS-I Basic Security    •   WS-Reliable
                              Profile                     Messaging
•   WS-SecurityPolicy                                •   WS-Reliability
                          •   WS-BPEL
•   WS-Discovery                                     •   WS-Atomic
                          •   WS-CDL                     Transaction
•   WS-Introspection
                          •   WS-Security            •   WS-Business Activity
•   WS-Metadata
    Exchange              •   WS-Secure              •   WS-Notification
                              Conversation
•   WS-Resource                                      •   WS-Eventing
    Framework             •   WS-Security Policy

•   WS-Eventing           •   WS-Trust               •   WS-Management

•   WS-Addressing         •   WS-Federation          •   WS-Management
                                                         Catalog
•   WS-Enumeration        •   WS-Federation Active   •   WS-Resource Transfer
                              Requestor Profile
The RESTful side
 Also known as “The Web”
1989
2008
@PHDThesis{REST,
     Author = {Roy Thomas Fielding},
      Title = {Architectural styles and the design of
               network-based software architectures},
       Year = {2000},
  Publisher = {University of California, Irvine},
}




                         2000
What is REST?

• REpresentational State Transfer
• An architectural style for distributed
  hypermedia systems
• A Uniform-Layered-Client-Cache-Stateless-
  Server with Code on Demand architectural
  style [Fielding2000, Figure 5-8]
What is REST?
What is REST?
• •Data elements
     Resources and identifiers
 •   Representations

 •
 •
     Metadata
     Control data               • •Components
                                     User agent


• •Connectors
     Client
                                 •
                                 •
                                     Origin server
                                     Gateway

 •   Server
                                 •   Proxy

 •   Cache

 •   Resolver
 •   Tunnel
Data elements
• Resources (and resource identifiers)
  “Any concept that might be the target of author’s hypertext”, addressable by well
  defined resource identifiers and associated to one or more representations


• Representations
  A machine-understandable description of the current resource state; typically a
  sequence of bytes in a well defined format known as the media-type


• Metadata
  Additional data used to provide additional information about a representation, that
  cannot be extrapolated from the representation itself


• Control data
  Information describing the purpose of a message exchanged between components
Connectors
• Client connector
  Initiates communication and performs requests


• Server connector
  Listens for connections and replies to requests


• Cache connector
  Associated to a client or server connector, saves replies to requests for a later usage


• Resolver
  Translates resource identifiers to network addresses for the actual communication


• Tunnel
  Relays communication across communication boundaries
Components
• User agent
  Uses a client connector to perform requests and is the final recipient of responses


• Origin server
  Uses a server connector for processing requests and providing responses. It is the
  source of resource representations and is the entity governing their state


• Proxy
  An intermediary entity selected by a client for performance enhancement, data
  translation, etc.


• Gateway
  An intermediary entity imposed by the network or by the origin server with similar
  functions as a proxy
REST and the Web

• URLs provide a consistent and accepted
  naming scheme for addressing resources
• HTTP provides the uniform interface for
  accessing resources
• Standard formats provide widely
  understood representations
Web Data Elements
  REST data element             Web instantiation



    Resource identifier                    URL



      Representation                 HTML, JPG, ...



  Representation medatada   Media-type, last-modification time



       Control data          if-modified-since, cache-control
Web Connectors
 REST connector   Web instantiation


      Client       libwww, libwww-perl


     Server        libwww, Apache API


      Cache       Browser cache, Akamai


     Resolver          Bind (DNS)


     Tunnel           SOCKS, SSL
Web Components
 REST component      Web instantiation



    Origin server   Apache httpd, Microsoft IIS



     User agent         Firefox, IE, Safari, ...



      Gateway              Squid, CGI, ...



       Proxy          CERN proxy, Gauntlet
A twisted perspective
  From interfaces to resources
REST Key principles

• Addressability
• Uniform interface
• Stateless communication
• Hypermedia As The Engine Of Application
  State
Addressability
• Using resource URIs to expose interesting
  part of system data and state
• All the pages talking about me: http://
  www.google.com/search?q=Fabio+Mancinelli

• Introduces nice properties (e.g., easy
  communication, bookmarking, caching,
  chaining...)
Uniform interface
• A single interface is used to access and
  manipulate resources
• Well defined semantics
• HTTP is the uniform interface to the web
  Verb (method)        Semantics                  Property
       GET        Retrieve a representation    Safe + Idempotent

       PUT         Store a representation         Idempotent

     DELETE          Delete a resource            Idempotent

      POST             Problems here!         A backdoor/mismatch
Uniform interface

  API1
           API2



                  APIn
    API3
Uniform interface




      Uniform interface
Twisted!
OrderManagementService

+ getOrders()
+ submitOrder()
+ getOrdersForCustomers()
+ updateOrder()
+ addOrderItem()
                        CustomerManagementService
+ cancelOrder()
                         + getCustomers()
                         + addCustomer()
                         + getCustomerDetail()
                         + updateCustomer()
                         + deleteCustomer()




                   [Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
Twisted!
         /orders

         GET - List all orders
         PUT
                                                          /customers/{id}/orders
         POST - Add new order
         DELETE
                                                          GET - Get all orders for customer
                                                          PUT
HTTP     /orders/{id}                                     POST - Add order
                                                          DELETE - Cancel all customer orders
GET      GET - Get order details
PUT      PUT - Update order
POST     POST - Add item                                  /customers/{id}
DELETE   DELETE - Cancel order
                                                          GET - Get customer detail
                                                          PUT - Update customer
         /customers                                       POST
                                                          DELETE - Delete customer
         GET - List all customers
         PUT - Update customer
         POST
         DELETE - Delete customer




                         [Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
Statelessness

• No conversational state: every request
  carries all the information needed to its
  fulfillment
• Implies that every possible server state is
  exposed as a resource
HATEOAS (!)
• Addressability enables clients to follow
  links to “next states”
• http://www.google.fr/search?q=Fabio
  +Mancinelli&start=2
Prior art
A sense of déjà vu?
Unix


(Almost) Everything is a file
Unix


(Almost) Everything is a file
     Uniform interface

     + read()
     + write()
Pipes

   for i in $(seq 13830 21829); do
     egrep "^From:" $i | awk '{print $2 $3}';
   done
   | sort | uniq -c | sort -nr | head -n15




[Extract the Top-15 most active people on the eclipse.newcomer newsgroup during the last year
      http://eclipsewebmaster.blogspot.com/2008/02/newcomer-newsgroups-top-15.html]
/dev        and /proc

/dev               /proc
 |--   hda          |-- cpuinfo
 |--   hda1         |-- kcore
 |--   cdrom        |-- modules
 |--   audio        |-- pci
 |--   ...          |-- ...
/dev     and /proc
• Make/dev/hda >image of the whole disk:
  cat
       a backup
                  backup.img

• Play music.mp3 > /dev/audio
  cat
       music:


• Record voice: > mytalk.wav
  cat /dev/audio

• Change system settings:
  echo “0” > /proc/sys/net/ipv4/ip_forward
Pervasively RESTful
  Bringing REST everywhere
A “Pervasive Web”
• From objects providing services to
  resources representing things (...and their
  state)
• Applying REST principles to the pervasive
  world
• Make pervasive contexts be part of “The
  Web” and not running on top of it.
The vision


Expose the “pervasive hardware” RESTfully
The vision
GET ptp://room/light



PTP/1.0 200 OK
Content-type: text/xml
<state>
  off
</state>
The vision
PUT ptp://room/light
Content-type: text/xml
<state>
  on
</state>



PTP/1.0 200 OK
Challenges
• KISS: Keep It Sweet & Simple!
• New architectures and protocols
  (extensions) for being pervasively RESTful:
  Is “The Web” enough?
• Reconcile pervasive world’s peculiar
  characteristics with a RESTful setting
• Overcoming REST limitations
Conclusions


• No conclusions yet... That’s the beginning!
Questions?


• WDYT? Does it make sense?

More Related Content

What's hot

ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresChristian Posta
 
Introduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David NalleyIntroduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David Nalleybuildacloud
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel ComponentsChristian Posta
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache CamelChristian Posta
 
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical informationZarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical informationZarafa
 
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday KeynoteZarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday KeynoteZarafa
 
Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Michel Schildmeijer
 
Openstack training material
Openstack training materialOpenstack training material
Openstack training materialchenvi123
 
Fusiondirectory: your infrastructure manager based on ldap
Fusiondirectory: your infrastructure manager based on ldapFusiondirectory: your infrastructure manager based on ldap
Fusiondirectory: your infrastructure manager based on ldapLDAPCon
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构Benjamin Tan
 
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...Lucas Jellema
 
"[WORKSHOP] K8S for developers", Denis Romanuk
"[WORKSHOP] K8S for developers", Denis Romanuk"[WORKSHOP] K8S for developers", Denis Romanuk
"[WORKSHOP] K8S for developers", Denis RomanukFwdays
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration TalkChristian Posta
 
NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013aspyker
 
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)Lucas Jellema
 
Continuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSContinuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSDaniel Woods
 
Seda与Java并行编程点滴
Seda与Java并行编程点滴Seda与Java并行编程点滴
Seda与Java并行编程点滴Benjamin Tan
 

What's hot (20)

Fabric8 mq
Fabric8 mqFabric8 mq
Fabric8 mq
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
 
Introduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David NalleyIntroduction to Apache CloudStack by David Nalley
Introduction to Apache CloudStack by David Nalley
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel Components
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
 
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical informationZarafa SummerCamp 2012 - Exchange Web Services, technical information
Zarafa SummerCamp 2012 - Exchange Web Services, technical information
 
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday KeynoteZarafa SummerCamp 2012 - Steve Hardy Friday Keynote
Zarafa SummerCamp 2012 - Steve Hardy Friday Keynote
 
Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020Keynote Oracle Fusion Middleware Summit_2020
Keynote Oracle Fusion Middleware Summit_2020
 
Openstack training material
Openstack training materialOpenstack training material
Openstack training material
 
Fusiondirectory: your infrastructure manager based on ldap
Fusiondirectory: your infrastructure manager based on ldapFusiondirectory: your infrastructure manager based on ldap
Fusiondirectory: your infrastructure manager based on ldap
 
Oracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node finalOracle application container cloud back end integration using node final
Oracle application container cloud back end integration using node final
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
 
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...
Introduction into Docker Containers, the Oracle Platform and the Oracle (Nati...
 
"[WORKSHOP] K8S for developers", Denis Romanuk
"[WORKSHOP] K8S for developers", Denis Romanuk"[WORKSHOP] K8S for developers", Denis Romanuk
"[WORKSHOP] K8S for developers", Denis Romanuk
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration Talk
 
NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013
 
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)
Event Bus as Backbone for Decoupled Microservice Choreography (JFall 2017)
 
Continuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSContinuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSS
 
Seda与Java并行编程点滴
Seda与Java并行编程点滴Seda与Java并行编程点滴
Seda与Java并行编程点滴
 

Similar to On being RESTful

An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST Ram Awadh Prasad, PMP
 
Introduction to Restful Web Services
Introduction to Restful Web ServicesIntroduction to Restful Web Services
Introduction to Restful Web Servicesweili_at_slideshare
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
Overview of REST - Raihan Ullah
Overview of REST - Raihan UllahOverview of REST - Raihan Ullah
Overview of REST - Raihan UllahCefalo
 
SOA and WCF (Windows Communication Foundation) basics
SOA and WCF (Windows Communication Foundation) basicsSOA and WCF (Windows Communication Foundation) basics
SOA and WCF (Windows Communication Foundation) basicsYaniv Pessach
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011Shreedhar Ganapathy
 
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...Spiffy
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)Alexander Goida
 
Introduction to REST
Introduction to RESTIntroduction to REST
Introduction to RESTkumar gaurav
 
Rest presentation
Rest  presentationRest  presentation
Rest presentationsrividhyau
 

Similar to On being RESTful (20)

An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
ReST
ReSTReST
ReST
 
Introduction to Restful Web Services
Introduction to Restful Web ServicesIntroduction to Restful Web Services
Introduction to Restful Web Services
 
Rest
RestRest
Rest
 
Mini-Training: Let's have a rest
Mini-Training: Let's have a restMini-Training: Let's have a rest
Mini-Training: Let's have a rest
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Web services for banks
Web services for banksWeb services for banks
Web services for banks
 
Overview of REST - Raihan Ullah
Overview of REST - Raihan UllahOverview of REST - Raihan Ullah
Overview of REST - Raihan Ullah
 
SOA and WCF (Windows Communication Foundation) basics
SOA and WCF (Windows Communication Foundation) basicsSOA and WCF (Windows Communication Foundation) basics
SOA and WCF (Windows Communication Foundation) basics
 
ReSTfulAPIs
ReSTfulAPIsReSTfulAPIs
ReSTfulAPIs
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
MS TechDays 2011 - How to Run Middleware in the Cloud Story of Windows Azure ...
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)
 
Introduction to REST
Introduction to RESTIntroduction to REST
Introduction to REST
 
REST API Design
REST API DesignREST API Design
REST API Design
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 

On being RESTful

  • 1. On being RESTful Fabio Mancinelli fm@fabiomancinelli
  • 2. What is this talk about? An introduction to the REST architectural style... A different way of looking at Service Oriented Computing
  • 3. What is this talk about? An introduction to the REST architectural style... A different way of looking at Service Oriented Computing ...and some ideas to foster discussion for finding new research directions! ☺
  • 4. A RESTless world Also known as “Service Oriented Architecture”
  • 5. Classic SOA Service • Web-services broker • WSDL Register Search • SOAP • UDDI Service provider Request Service requester
  • 6. Classic SOA Service • Web-services broker UDDI • WSDL Register WSDL WSDL Search • SOAP • Service Service SOAP UDDI provider Request requester Web Service
  • 7. Web(?) services “Definition: A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.” [W3C, http://www.w3.org/TR/ws-arch/#whatis]
  • 8. WSDL XML description of the service interface
  • 9. SOAP • Was “Simple Object Access Protocol”, sometimes referred as SOA-Protocol • Simply an XML-based messaging protocol used mainly as an RPC protocol
  • 10. UDDI • Universal Description, Discovery and Integration • Platform-independent, XML-based registry for business services • Accessible via SOAP, provides WSDLs (... and other complementary information)
  • 11. The WS-* hell • WS-Policy • WS-Transfer • WS-Federation Passive Requestor • WS-PolicyAssertions • WS-I Basic Profile Profile • WS-PolicyAttachment • WS-I Basic Security • WS-Reliable Profile Messaging • WS-SecurityPolicy • WS-Reliability • WS-BPEL • WS-Discovery • WS-Atomic • WS-CDL Transaction • WS-Introspection • WS-Security • WS-Business Activity • WS-Metadata Exchange • WS-Secure • WS-Notification Conversation • WS-Resource • WS-Eventing Framework • WS-Security Policy • WS-Eventing • WS-Trust • WS-Management • WS-Addressing • WS-Federation • WS-Management Catalog • WS-Enumeration • WS-Federation Active • WS-Resource Transfer Requestor Profile
  • 12. The RESTful side Also known as “The Web”
  • 13. 1989
  • 14. 2008
  • 15. @PHDThesis{REST, Author = {Roy Thomas Fielding}, Title = {Architectural styles and the design of network-based software architectures}, Year = {2000}, Publisher = {University of California, Irvine}, } 2000
  • 16. What is REST? • REpresentational State Transfer • An architectural style for distributed hypermedia systems • A Uniform-Layered-Client-Cache-Stateless- Server with Code on Demand architectural style [Fielding2000, Figure 5-8]
  • 18. What is REST? • •Data elements Resources and identifiers • Representations • • Metadata Control data • •Components User agent • •Connectors Client • • Origin server Gateway • Server • Proxy • Cache • Resolver • Tunnel
  • 19. Data elements • Resources (and resource identifiers) “Any concept that might be the target of author’s hypertext”, addressable by well defined resource identifiers and associated to one or more representations • Representations A machine-understandable description of the current resource state; typically a sequence of bytes in a well defined format known as the media-type • Metadata Additional data used to provide additional information about a representation, that cannot be extrapolated from the representation itself • Control data Information describing the purpose of a message exchanged between components
  • 20. Connectors • Client connector Initiates communication and performs requests • Server connector Listens for connections and replies to requests • Cache connector Associated to a client or server connector, saves replies to requests for a later usage • Resolver Translates resource identifiers to network addresses for the actual communication • Tunnel Relays communication across communication boundaries
  • 21. Components • User agent Uses a client connector to perform requests and is the final recipient of responses • Origin server Uses a server connector for processing requests and providing responses. It is the source of resource representations and is the entity governing their state • Proxy An intermediary entity selected by a client for performance enhancement, data translation, etc. • Gateway An intermediary entity imposed by the network or by the origin server with similar functions as a proxy
  • 22. REST and the Web • URLs provide a consistent and accepted naming scheme for addressing resources • HTTP provides the uniform interface for accessing resources • Standard formats provide widely understood representations
  • 23. Web Data Elements REST data element Web instantiation Resource identifier URL Representation HTML, JPG, ... Representation medatada Media-type, last-modification time Control data if-modified-since, cache-control
  • 24. Web Connectors REST connector Web instantiation Client libwww, libwww-perl Server libwww, Apache API Cache Browser cache, Akamai Resolver Bind (DNS) Tunnel SOCKS, SSL
  • 25. Web Components REST component Web instantiation Origin server Apache httpd, Microsoft IIS User agent Firefox, IE, Safari, ... Gateway Squid, CGI, ... Proxy CERN proxy, Gauntlet
  • 26. A twisted perspective From interfaces to resources
  • 27. REST Key principles • Addressability • Uniform interface • Stateless communication • Hypermedia As The Engine Of Application State
  • 28. Addressability • Using resource URIs to expose interesting part of system data and state • All the pages talking about me: http:// www.google.com/search?q=Fabio+Mancinelli • Introduces nice properties (e.g., easy communication, bookmarking, caching, chaining...)
  • 29. Uniform interface • A single interface is used to access and manipulate resources • Well defined semantics • HTTP is the uniform interface to the web Verb (method) Semantics Property GET Retrieve a representation Safe + Idempotent PUT Store a representation Idempotent DELETE Delete a resource Idempotent POST Problems here! A backdoor/mismatch
  • 30. Uniform interface API1 API2 APIn API3
  • 31. Uniform interface Uniform interface
  • 32. Twisted! OrderManagementService + getOrders() + submitOrder() + getOrdersForCustomers() + updateOrder() + addOrderItem() CustomerManagementService + cancelOrder() + getCustomers() + addCustomer() + getCustomerDetail() + updateCustomer() + deleteCustomer() [Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
  • 33. Twisted! /orders GET - List all orders PUT /customers/{id}/orders POST - Add new order DELETE GET - Get all orders for customer PUT HTTP /orders/{id} POST - Add order DELETE - Cancel all customer orders GET GET - Get order details PUT PUT - Update order POST POST - Add item /customers/{id} DELETE DELETE - Cancel order GET - Get customer detail PUT - Update customer /customers POST DELETE - Delete customer GET - List all customers PUT - Update customer POST DELETE - Delete customer [Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
  • 34. Statelessness • No conversational state: every request carries all the information needed to its fulfillment • Implies that every possible server state is exposed as a resource
  • 35. HATEOAS (!) • Addressability enables clients to follow links to “next states” • http://www.google.fr/search?q=Fabio +Mancinelli&start=2
  • 36. Prior art A sense of déjà vu?
  • 38. Unix (Almost) Everything is a file Uniform interface + read() + write()
  • 39. Pipes for i in $(seq 13830 21829); do egrep "^From:" $i | awk '{print $2 $3}'; done | sort | uniq -c | sort -nr | head -n15 [Extract the Top-15 most active people on the eclipse.newcomer newsgroup during the last year http://eclipsewebmaster.blogspot.com/2008/02/newcomer-newsgroups-top-15.html]
  • 40. /dev and /proc /dev /proc |-- hda |-- cpuinfo |-- hda1 |-- kcore |-- cdrom |-- modules |-- audio |-- pci |-- ... |-- ...
  • 41. /dev and /proc • Make/dev/hda >image of the whole disk: cat a backup backup.img • Play music.mp3 > /dev/audio cat music: • Record voice: > mytalk.wav cat /dev/audio • Change system settings: echo “0” > /proc/sys/net/ipv4/ip_forward
  • 42. Pervasively RESTful Bringing REST everywhere
  • 43. A “Pervasive Web” • From objects providing services to resources representing things (...and their state) • Applying REST principles to the pervasive world • Make pervasive contexts be part of “The Web” and not running on top of it.
  • 44. The vision Expose the “pervasive hardware” RESTfully
  • 45. The vision GET ptp://room/light PTP/1.0 200 OK Content-type: text/xml <state> off </state>
  • 46. The vision PUT ptp://room/light Content-type: text/xml <state> on </state> PTP/1.0 200 OK
  • 47. Challenges • KISS: Keep It Sweet & Simple! • New architectures and protocols (extensions) for being pervasively RESTful: Is “The Web” enough? • Reconcile pervasive world’s peculiar characteristics with a RESTful setting • Overcoming REST limitations
  • 48. Conclusions • No conclusions yet... That’s the beginning!
  • 49. Questions? • WDYT? Does it make sense?