Rest
Upcoming SlideShare
Loading in...5
×
 

Rest

on

  • 315 views

 

Statistics

Views

Total Views
315
Views on SlideShare
315
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Rest Rest Presentation Transcript

  • Your data needs to bepromiscuousIf there’s any hope of ithooking up with the iPhone
  • Your data needs to bepromiscuousIf there’s any hope of ithooking up with the iPhone
  • API• The I means Interface• Necessary to interact with any application outside of a web site • Smart phone • Ajax View slide
  • BPEL SOAPRPC WSDL View slide
  • Facebook
  • Twitter
  • REST• Representational• State• Transfer
  • Representing State• JSON• HTML• PDF• XML?
  • XMLJames Clark: “My reaction to JSON is a combination of ‘Yay’ and ‘Sigh’. Its ‘Yay’, because for important use cases JSON is dramatically better than XML. In particular, JSON shines as a programming language- independent representation of typical programming language data structures. This is an incredibly important use case and it would be hard to overstate how appallingly bad XML is for this. The fundamental problem is the mismatch between programming language data structures and the XML element/attribute data model of elements.”
  • Verbs• GET: Retrieve data• PUT: Replace data• POST: Add data• [PATCH]: Update data• DELETE: Remove data
  • HTTP
  • Collections• GET: List items in a collection• PUT: Replace a collection with new items • Functions as a PATCH in the real world• POST: Add an item to this collection • New or existing item• DELETE: Remove all items in this collection • There be danger
  • Item• GET: Retrieve the representation of this item• PUT: Update the item with new values • Functions as PATCH in the real world• DELETE: Remove the item
  • Uniformity• Relative to a base URL • A description of resources often placed here• Collections are identified by the type of object in the collection • http://baseurl/resource/• Items are identified by the type and ID of the item • http://baseurl/resource/12• Collections can be related to a specific item • http://bareurl/parent/12/resource
  • Varied Representations• Requesting a return type may be done through resource URL • http://baseurl/resource/12.json • http://baseurl/resource/12.html• Requesting a return type may be done through Accept header • Accept: application/json
  • Responses• Use HTTP error codes where appropriate• Standardize a method of measuring success• Standardize a method of returning errors • Add an error flag • State the main error message • State the error type • Allow data to be conveyed along with the error
  • Blog• Uses many REST patterns• Collection of posts often at /blog/ • Object type used for lookup• Items usually at /blog/id• Items can be added to a category “collection” of posts
  • Caching• GET requests can be cached by browsers • Should never alter state • Several headers in the return enable it• No other verbs will be cached regardless of headers
  • HTTP
  • Security• Date, URL, content can be combined and hashed • HMAC-SHA-1 with a secret key • API ID sent in a header • Used by many Amazon services