Publishing and Eding Web Resources Atom Publishing Protocol · Publishing and Eding Web Resources...
Transcript of Publishing and Eding Web Resources Atom Publishing Protocol · Publishing and Eding Web Resources...
Publishing and Edi.ng Web Resources
Atom Publishing Protocol CS 431 – Spring 2008 Cornell University
Carl Lagoze – 03/12/08
• Acknowledgments – Dan Diephouse – netzooid.org – Elizabeth Fisher – Colorado – Ibm.com/developerworks
Atom
• ANempt to ra.onalize RSS 1.x, 2.x divergence • Encoding is up‐to‐date with current XML standards
– namespaces – Schema
• Robust content model – Dis.nguishes between metadata and content (plain text, HTML, base‐64 binary)
• Well‐defined extensibility model • IETF FRC 4287
– hNp://www.ie\.org/rfc/rfc4287
Structure of Feed • Feed
– ID – Author – Link – Title – Updated – * – Entry
• ID • Updated • Link • Summary • Content • *
Simple Atom Feed <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom">
<title>Dan’s Blog</title> <link href="http://netzooid.com/blog/"/> <updated>2007-11-07T18:30:02Z</updated> <author> <name>Dan Diephouse</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
<entry> <title>Building services with AtomPub</title> <link href="http://netzooid.com/blog/atompub_services"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2007-11-07T18:30:02Z</updated> <content> … (you must have content or a summary) </content> </entry>
</feed>
Feed id
Entry id
“alternate” (source) id
Atom Publishing Protocol (APP)
• HTTP‐based protocol for publishing, dele.ng, and upda.ng resources
• hNp://bitworking.org/projects/atom/drab‐ie\‐atompub‐protocol‐08.html
• Generic API for crea.on, access, modifica.on, dele.on of resources (calendar entries, blog entries, etc.) – Google Data API – Microsob Live Pla\orm
Generic Packaging Model
• En.ty containing en..es (compound documents)
• Each en.ty has a unique URI • Adding an en.ty to a package produces a new URI
• All opera.ons done on URIs with HTTP protocol requests
Recall HTTP
• GET: Used to retrieve a representa.on of a collec.on or member resource
• POST: Used to create a new member resource
• PUT: Used to update a member resource
• DELETE: Used to remove a member resource
• Headers – Metadata about request and response
Simple HTTP GET ‐ Response
GET /path/file.html HTTP/1.1 Host: cs.cornell.edu User‐Agent: Mozilla/3.0 [Blank line]
HTTP/1.1 200 OK Content‐Type: text/html Date: Wed, 31 Jan 2007 14:58:57 GMT Content‐Length: 1354
<html> <head> …
Representa.onal State Transfer (REST) Programming
• Basis of many modern web APIs • Alterna.ve to complex services APIs such as SOAP
• Basics – Built en.rely on HTTP requests – Access and manipulate resources via HTTP • One‐to‐one mapping from resources to URI
Atom Publishing Protocol Model
Service
Workspaces
Collec.ons Entries
• Entry Resource Media Entries • Media Link Entry • Media Resource
APP Resource/En.ty URI Structure
Resources /
/blog/feed
/blog/feed/entry.atom
/blog/entry
Descrip.on Service
Collec.on
Entry
Alternate Representa.on
Service Introspec.on Document GET /
<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> <workspace> <atom:title>Dan’s Website</atom:title>
<collection href="http://netzooid.com/blog/feed"> <atom:title>Dan’s Blog</atom:title> </collection>
<collection href="http://netzooid.com/pics"> <atom:title>Dan’s Pictures</atom:title> <accept>image/png</accept> <accept>image/jpeg</accept> <accept>image/gif</accept> </collection>
</workspace> </service>
“alternate” representa.on
From collec.on to resource GET /blog/feed
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom">
<title>Dan’s Blog</title> <link href="http://netzooid.com/blog/"/> <updated>2007-12-13T18:30:02Z</updated> <author> <name>Dan Diephouse</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
<entry> <title>Building services with AtomPub</title> <link href="http://netzooid.com/blog/app_services"/> <link href="http://netzooid.com/blog/app_services“ rel="edit"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2007-12-13T18:30:02Z</updated> <content> … (you must have content or a summary) </content> </entry>
</feed>
Editable entry
“alternate” representa.on
Retrieve individual entry GET /blog/feed/app_services.atom
<entry> <title>Building services with AtomPub</title> <link href="http://netzooid.com/blog/app_services"/> <link href="http://netzooid.com/blog/feed/app_services.atom“ rel=“edit” /> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2007-12-13T18:30:02Z</updated> <content> … </content> </entry>
APP and Atom Media Resources
• Manipula.on of generic (non‐XML) resources via APP – Photo collec.ons – Podcasts – Video blogging – Wikis – Sobware repositories – Office suits
• Concepts – Media Resource – typed content – Media Link – atom entry (metadata) about content
APP Media Resource Data Model
Resources
/pics
/pics/pic.png
/pics/pic.atom
Descrip.on
Collec.on
Media Resource
Media Link Entry
Media Service <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> <workspace> <atom:title>Dan’s Website</atom:title>
<collection href="http://netzooid.com/blog/feed"> <atom:title>Dan’s Blog</atom:title> </collection>
<collection href="http://netzooid.com/pics"> <atom:title>Dan’s Pictures</atom:title> <accept>image/png</accept> <accept>image/jpeg</accept> <accept>image/gif</accept> </collection>
</workspace> </service>