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> Feed id <name>dan Diephouse</name> </author> Entry id <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> alternate (source) id
Extending Atom with namespaces
Embedding Content in Atom
Embedding Content in Atom
Atom Publishing Protocol (APP) HTTP based protocol for publishing, dele.ng, and upda.ng resources hnp://bitworking.org/projects/atom/drabie\ 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 Descrip.on / Service /blog/feed Collec.on /blog/feed/entry.atom Entry /blog/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> alternate representa.on Editable entry
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>
Create a new entry
HTTP Response to POST
APP Post for Google Calendar
Editable Atom Entry
PUT of modified entry Prevent Overwrites
Delete an 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 Descrip.on /pics Collec.on /pics/pic.png Media Resource /pics/pic.atom 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>
Pos.ng Media Hint to server for naming of resource
Response to Media POST