REST - A Super Quick Intro
Upcoming SlideShare
Loading in...5
×
 

REST - A Super Quick Intro

on

  • 2,666 views

A super-quick and high-level introduction to the principles of REST, prepared for the AusPost SAP development team

A super-quick and high-level introduction to the principles of REST, prepared for the AusPost SAP development team

Statistics

Views

Total Views
2,666
Views on SlideShare
2,662
Embed Views
4

Actions

Likes
8
Downloads
53
Comments
0

2 Embeds 4

http://www.linkedin.com 3
http://localhost 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    REST - A Super Quick Intro REST - A Super Quick Intro Presentation Transcript

    • REST
      A Super-Quick Introduction
    • REpresentationalStateTransfer
    • Say What???
    • Apply ‘Web’ Principles to A2A Integration Problems
    • Remember the OSI Stack?
      http://en.wikipedia.org/wiki/Osi_stack
    • So what?
    • REST uses HTTP as the Application Protocol!
      Not (just) as the transport
    • How does that work?
    • Standard Verbs
      The HTTP Spec give you the verbs to use:
      GET
      PUT
      POST
      DELETE
      HEAD
      OPTIONS
      PATCH
      TRACE
      http://en.wikipedia.org/wiki/HTTP#Request_methods
    • SOAP Doesn’t…
      getAccountCustomerByInternalId
      searchCustomerByBasicData
      updateSalesProspectStatusByPartnerSalesRepresentativeBasicData_sync
      Everything works via HTTP POST
      (i.e. uses HTTP as the dumb transport)
    • Status Codes
      The HTTP Spec give you the verbs to use:
      200 OK
      302 Moved Permanently
      404 Not Found
      406 Method Not Allowed
      418 I’m a Teapot

      http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
    • SOAP Doesn’t…
      <SOAP-ENV:Faultxmlns:sqlsoapfaultcode="http://schemas.microsoft.com/sqlserver/2004/SOAP/SqlSoapFaultCode">
      <faultcode>SOAP-ENV:Client</faultcode>
      <faultstring>There was an error in the incoming SOAP request packet: Client, InvalidXml</faultstring>
      <faultactor>http://schemas.microsoft.com/sqlserver/2004/SOAP</faultactor>
      <detail xmlns:SOAP-1_2-ENV="http://www.w3.org/2003/05/soap-envelope">
      <SOAP-1_2-ENV:Code>
      <SOAP-1_2-ENV:Value>SOAP-1_2-ENV:Sender</SOAP-1_2-ENV:Value>
      <SOAP-1_2-ENV:Subcode>
      <SOAP-1_2-ENV:Value>sqlsoapfaultcode:InvalidXml</SOAP-1_2-ENV:Value>
      </SOAP-1_2-ENV:Subcode>
      </SOAP-1_2-ENV:Code>
      <SOAP-1_2-ENV:Reason>
      <SOAP-1_2-ENV:Text xml:lang="en-US">There was an error in the incoming SOAP request packet: Sender, InvalidXml</SOAP-1_2-ENV:Text>
      </SOAP-1_2-ENV:Reason>
      <SOAP-1_2-ENV:Node>http://MyServer:80/sql</SOAP-1_2-ENV:Node>
      <SOAP-1_2-ENV:Role>http://schemas.microsoft.com/sqlserver/2004/SOAP</SOAP-1_2-ENV:Role>
      <SOAP-1_2-ENV:Detail>
      <sqlresultstream:SqlMessagexsi:type="sqlmessage:SqlMessage">
      <sqlmessage:Class>16</sqlmessage:Class>
      <sqlmessage:LineNumber>0</sqlmessage:LineNumber>
      <sqlmessage:Message>XML parsing: line 3, character 0, incorrect document syntax</sqlmessage:Message>
      <sqlmessage:Number>9422</sqlmessage:Number>
      <sqlmessage:Source>Microsoft-SQL/9.0</sqlmessage:Source>
      <sqlmessage:State>1</sqlmessage:State>
      </sqlresultstream:SqlMessage>
      </SOAP-1_2-ENV:Detail>
      </detail>
      </SOAP-ENV:Fault>
    • So What’s Wrong with that?
    • So What’s Wrong with that?
      Suboptimal
    • Scalability
      HTTP GET is the most optimised piece of code on the planet!
      Easily cached to support millions of clients
      Defined semanticsHTTP = Application Protocol
      Everyone knows how to do a GET
      Everyone knows how to behave
    • We Exchange Representations
    • Representations?
      The server can store its data/objects in whatever way it likes
      The clients can store the same stuff differently
      We serialise that into Representations
    • Less Abstract…
      A Website is a Representation of the server’s database, code, etc.
      Clients don’t care how the server stores it, as long as it understands the Representation
    • State Transfer?
    • State is Transferred between Server and Client
      Not just kept at the Server!
    • Client requests Shopping Cart
      Server sends HTML page with items and links
      Client’s move
      Client clicks “Check Out”
      Server sends HTML page with Total Amount
      Client’s move
      Client clicks “Pay”
      Server sends HTML page with “Thank You”
      and we’re done!
    • Notice Something?
    • The Client Drives the Interaction
      Responsible for moving forward
      Or not!
      The server guides the client forward
      (with ‘Check Out’, ‘Pay’ links)
      The client is responsible for completing the process
      If the client stops, the server doesn’t care!
    • And…
    • Everything has a URL
    • So it’s like the Web!
      …Just for Machines
    • Restbucks
      works with whisky too ;-)
      http://www.infoq.com/articles/webber-rest-workflow
    • So, the Formal Principles:
    • REST Principles
      Identify Resources (URLs)
      Manipulate Resources through Representations
      Self-Descriptive Messages
      HATEOAS
      http://www.infoq.com/articles/rest-introduction
    • HypertextAsTheEngineOfApplicationState
    • In other words:
      Linking Things TogetherDriving the Process via Links
      Like the ‘Check Out’ link!
    • …and some Constraints:
      Client-Server
      Stateless
      Cacheable
      Layered System
      Uniform Interface
      Duh!
      = scalable
      = scalable
      load balancers, proxies
      HTTP verbs & codes
    • Finally:
      http://geekandpoke.typepad.com/geekandpoke/2009/11/service-calling-made-easy-part-1.html
    • More Resources:
      http://en.wikipedia.org/wiki/REST
      http://www.infoq.com/rest
      http://www.infoq.com/articles/webber-rest-workflow
      http://www.infoq.com/minibooks/emag-03-2010-rest (Excellent FREE eBook)
      CD108 from 2010 TechEd
      https://www.ibm.com/developerworks/webservices/library/ws-restful/