Gallery3:Atom resource representations - Gallery Codex
Personal tools

Gallery3:Atom resource representations

From Gallery Codex

Gallery 3 uses Atom to represent its resources exposed through REST. General comments:

  • The Atom spec supports a feed generator element that defines the generator's URI, version and name. If we support this, one issue may be that multiple Gallery modules may contribute to a single feed.
  • We can support a per feed icon if we wish.

Comment module

We expose the following:

  • Atom feed for item comments (/comments?item_id={item_id})&_format=atom
  • Atom entry for individual comments (/comments/{comment_id})&_format=atom

Item comments feed

We can describe the comment feed using only standard Atom constructs. The only problem is that all Atom entries must have a title element that should not be empty. Issues:

  • Comments do not have titles and that element is empty in our feed.
 <?xml version="1.0" encoding="utf-8"?>
 <feed xmlns="http://www.w3.org/2005/Atom">
   <id>http://gallery.example.com/comments</id>
   <title type="text">Comments on Ocean Beach Sunset</title>
   <updated>2008-11-15T12:00:00Z</updated>
   <link rel="self" href="http://gallery.example.com/comments" />
   <link rel="related"
         type="application/atom+xml"
         title="Get photo meta data"
         href="http://gallery.example.com/photos/23" />
   <link rel="related"
         type="text/html"
         title="View photo in Gallery"
         href="http://gallery.example.com/photos/23" />
   <link rel="related" 
         type="image/jpeg"
         title="Download photo"
         href="http://gallery.example.com/photos/SanFran/sunset.jpg"
         length="1234" />
 
   <entry>
     <id>http://gallery.example.com/comments/32</id>
     <updated>2008-11-15T12:00:00Z</updated>
     <title></title>
     <author>
       <uri>http://gallery.example.com/users/3</uri>
       <name>Jonathan Doe</name>
       <email>jdoe@example.com</email>
     </author>
     <content type="html">Wow, that's &lt;b>beautiful!&gt;/b></content>
   </entry>
 </feed>

Comment entry

We expose all of a comment's meta data, plus links to its photo, photo meta data and user meta data.

 <?xml version="1.0" encoding="utf-8"?>
 <entry xmlns="http://www.w3.org/2005/Atom">
   <id>http://gallery.example.com/comments/32</id>
   <updated>2008-11-15T12:00:00Z</updated>
   <title>Comment on Ocean Beach Sunset</title>
   <author>
     <uri>http://gallery.example.com/users/3</uri>
     <name>Jonathan Doe</name>
     <email>jdoe@example.com</email>
   </author>
   <content type="html">Wow, that's &lt;b>beautiful!&gt;/b></content>
 
   <link rel="self" href="http://gallery.example.com/comments/32" />
   <link rel="related"
         type="application/atom+xml"
         title="Get photo meta data"
         href="http://gallery.example.com/photos/23" />
   <link rel="related"
         type="text/html"
         title="View photo in Gallery"
         href="http://gallery.example.com/photos/23" />
   <link rel="related" 
         type="image/jpeg"
         title="Download photo"
         href="http://gallery.example.com/photos/SanFran/sunset.jpg"
         length="1234" />
 </entry>