real world rest with atom/atompub
TRANSCRIPT
Real World RESTwith Atom/AtomPub
What is REST?
•set of design principles
•widely implemented (the Web!)
• a term coined by Roy Fielding for his doctoral dissertation
What is REST?
•a useful set of best practices for building web apps
• an “interface” for the web
• simple (but not necessarily easy)
RESTful Apps
•“play well” with others
• are evolvable
• are robust & maintainable
• can be secure
What is Atom?
•a simple XML format
• very similar to RSS
• useful for representing web content
What is AtomPub?
•Atom Publishing Protocol
• a standard for “writing” to the web
• based on REST principles
Who is implementing Atom/AtomPub?
•Microsoft
• IBM
•LAITS :-)
REST principles
•Everything is a Resource
•Resources have Names
•Simple operations (GET, PUT, POST,
DELETE)
REST principles
•Resources have Representations
•Hypermedia is the Engine of Application State
REST principles in practice
• Everything is a Resource
• bookmarks
• orders
• employees
• media files
REST principles in practice
• Resources have Names
• http://del.icio.us/pkeane/rest
• http://.../orders/234
• http://.../employee/pkeane
• http://.../funnycats.jpg
REST principles in practice
• Simple operations
• GET http://del.icio.us/pkeane
• POST to http://.../orders
• PUT http://.../employee/pkeane
• DELETE http://.../funnycats.jpg
REST principles in practice
• Resources have Representations<feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <link href="http://example.org/"/> <updated>2003-12-13T18:30:02Z</updated> <author> <name>John Doe</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <entry> [...] </entry>
REST principles in practice
• Resources have Representations{ "updated": "2008-06-24T20:38:12-05:00", "name": "search: Alfred Waud in american_west.artist", "items": [ { "media": { "thumbnail": "http://dase/media/american_west/thumbnail/00194933_100.jpg", "small": "http://dase/media/american_west/small/000194933_640.jpg”, "medium": "http:/dase/media/american_west/medium/000194933_800.jpg", "large": "http://dase/media/american_west/large/000194933_1024.jpg", } } ]}
REST principles in practice
• Resources have Representations
<html> <head> <title>funny cat picturs</title> </head> <body> <h1>My Cat Ernie</h1> <img src=”http://flickr.com/pkeane/set/33/image/2.jpg”/> </body></html>
REST principles in practice
• Resources have Representationshttp://flickr.com/pkeane/set/33/image/2.jpg
REST principles in practice
• Hypertext is the Engine of Application State
REST principles in practice
• Hypertext is the Engine of Application State
Huh?
REST principles in practice
• Hypertext is the Engine of Application State
The representation ITSELF gives you all of the information you need to perform
more useful operations.
REST principles in practice
• Hypertext is the Engine of Application State
• Links:
• <a href=”...”>news</a>
• <img src=”cat.png”/>
• <link type=”text/css” href=”style.css”/>
• Forms:
• <form action=”orders” method=”post”>....</form>
REST in DASe
RESTful Google Docs
Google LAITS Server
Browser
POST (form)XHR (Atom)
GET (Atom)
Why REST?
•Developers have a better understanding of the benefits of HTTP & statelessness
•AJAX has made HTTP cool
•Django/Rails encourages good RESTful practices (Struts didn’t)
Why REST?
•Mash-ups & Web 2.0
•Atom, JSON, XHTML
•Cloud Computing / Distributed Systems
Topics/Ideas
• loose coupling
• “engineer for serendipity”
• resources, not procedures
• reuse
Topics/Ideas
• functional programming at web-scale
• declarative syntaxes
• high value on good specs
•mime-types
Topics/Ideas
•decomposition
• complex procedures can be modeled as document passing
• simple/generic interfaces
•UNIX philosophy
Resources
•http://del.icio.us/pkeane/rest+fyi
• http://dase.googlecode.com