<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code: Flickr Developer Blog &#187; syndication</title>
	<atom:link href="http://code.flickr.com/blog/tag/syndication/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.flickr.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 19 Nov 2009 15:59:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>API Responses as Feeds</title>
		<link>http://code.flickr.com/blog/2008/08/25/api-responses-as-feeds/</link>
		<comments>http://code.flickr.com/blog/2008/08/25/api-responses-as-feeds/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 19:20:45 +0000</pubDate>
		<dc:creator>kellan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[flickr.photos.search]]></category>
		<category><![CDATA[syndication]]></category>

		<guid isPermaLink="false">http://code.flickr.com/blog/?p=104</guid>
		<description><![CDATA[You know three things that would be cool?

the ability to subscribe to the output of a Flickr API call in a feed aggregator
the ability to get the results of Flickr API calls as KML (or GeoRSS)
if all those devices that support RSS feeds (like photo frames!) also supported the Flickr API.

You see where I&#8217;m going [...]]]></description>
			<content:encoded><![CDATA[<p>You know three things that would be cool?</p>
<ul>
<li>the ability to subscribe to the output of a Flickr API call in a feed aggregator</li>
<li>the ability to get the results of Flickr API calls as KML (or GeoRSS)</li>
<li>if all those devices that support RSS feeds (like photo frames!) also supported the Flickr API.</li>
</ul>
<p>You see where I&#8217;m going with this don&#8217;t you?  </p>
<p>You can already specify that you want the output format of a Flickr API call to be REST  (POX), XML-RPC, SOAP (shudder, not sure that one still works), JSON, or serialized PHP.  We always wanted to support formats like KML, or Atom but we were never quite sure how to represent the results of a call to <code>flickr.photos.getInfo()</code> or <code>flickr.photos.licenses.getInfo()</code> as a KML.</p>
<p>Last week we finally got around to pushing out our 80% solution &#8212; an experimental response format for API methods that use the <a href="http://code.flickr.com/blog/2008/08/19/standard-photos-response-apis-for-civilized-age/">standard photos response</a> format that allows you to request API responses as as one of our <a href="http://www.flickr.com/services/feeds/">many feed formats</a>.</p>
<p>You can now get the output of <code>flickr.photos.search()</code>, or <code>flickr.favorites.getList()</code> as Atom, or GeoRSS, or KML, or whatever.</p>
<h3 id="api_feed_types">API Feed Types</h3>
<p>The syntax is <code>"&amp;format=feed-{SOME_FEED_IDENTIFER}"</code> where the feed identifiers follow the same convention you use when fetching&#8230;feeds.</p>
<ul>
<li>feed-rss_100, API results will be returned as a RSS 1.0 feed</li>
<li>feed-rss_200, API results will be returned as a RSS 2.0 feed</li>
<li>feed-atom_10, API results will be returned as a Atom 1.0 feed</li>
<li>feed-georss, API results will be returned as a RSS 2.0 feed<br />
with corresponding GeoRSS and W3C Geo elements for geotagged<br />
photos</li>
<li>feed-geoatom, API results will be returned as a Atom 1.0 feed<br />
with corresponding GeoRSS and W3C Geo elements for geotagged<br />
photos</li>
<li>feed-geordf, API results will be returned as a RSS 1.0 feed<br />
with corresponding GeoRSS and W3C Geo elements for geotagged<br />
photos</li>
<li>feed-kml, API results will be returned as a KML 2.1 feed</li>
<li>feed-kml_nl, API results will be returned as a KML 2.1 network<br />
link feed</li>
</ul>
<p>And remember, <code>format</code> is an API arg, and needs to be included in your API signature if you&#8217;re making a signed API call.</p>
<h3 id="namespaces_pagination_bits_and_bobs">Namespaces, pagination, bits and bobs</h3>
<p>You&#8217;ll find the feeds now include the venerable xmlns:flickr=&#8221;urn:flickr:&#8221; namespace.  This is used to declare bits that don&#8217;t fit elsewhere like pagination.</p>
<p>Pagination information is passed as a single namespaced (&#8216;urn:flickr:)<br />
element under the feed&#8217;s root (or &#8220;channel&#8221; element if it has one). For<br />
everything but RSS 1.0 based feeds it looks like this:</p>
<pre><code>&lt;flickr:pagination total="480" page="1" pages="96"
per_page="5" /&gt;
</code></pre>
<p>For RSS 1.0 we do a little RDF dance:</p>
<pre><code>&lt;flickr:flickr&gt;
     &lt;pagination&gt;
             &lt;total&gt;480&lt;/total&gt;
             &lt;page&gt;1&lt;/page&gt;
                 &lt;pages&gt;32&lt;/pages&gt;
             &lt;per_page&gt;15&lt;/per_page&gt;
     &lt;/pagination&gt;
&lt;/flickr:flickr&gt;
</code></pre>
<p>Speaking of pagination, to start with we&#8217;ve enforced a maximum &#8220;per<br />
page&#8221; limit of 15. If people have a reasonable use case we may<br />
consider raising the limit but otherwise we need to account for the<br />
extra data/size that feed formats add.</p>
<p>You&#8217;ll also find some extras like</p>
<pre><code>&lt;entry&gt;
    ...
    &lt;flickr:views&gt;3&lt;/flickr:views&gt;
    &lt;flickr:original type="png" href="http://farm4.static.flickr.com/3074/2783931781_12f84e4079_o.png" width="640" height="480" /&gt;
&lt;/entry&gt;
</code></pre>
<h3 id="error_handling">Error Handling</h3>
<p>If an error occurs, the API will return a 400 HTTP status code. </p>
<p>Flickr error codes and message are returned as X-FlickrErrCode and X-FlickrErrMessage<br />
HTTP headers. For example:</p>
<pre><code>X-FlickrErrCode: 111
X-FlickrErrMessage: Format "feed-lolcat" not found
</code></pre>
<h3 id="caveats_and_warnings">Caveats and Warnings</h3>
<ul>
<li>
<p>This is EXPERIMENTAL.  It might change, it might go away, but we hope not.  We also could potentially make it better based on all your awesome feedback.</p>
</li>
<li>
<p>This is not available for all methods. If you call <code>photos.getInfo</code> and<br />
ask for a feed response format all you will get is an error.</p>
</li>
<li>
<p>Just like any API call (or feed usage or really anything else) you are required to respect the copyright of the photographer. </p>
</li>
<li>
<p>These are still API calls.  All the usual rules about usage apply.<br />
You are still bound by the Flickr API TOU and any other rules,<br />
capricious or not, we apply to API usage.  Including rate limits.  If<br />
you feed this in to an overly-aggressive aggregator we will make your<br />
API key cry. (In an entirely non-creepy way)</p>
</li>
</ul>
<h3 id="putting_it_together_ego_feeds">Putting it together: ego feeds</h3>
<p>Turns out &#8216;kellan&#8217; is a popular baby name these days, so whenever I go ego surfing Flickr I tend to see pictures of two year olds.  This changes (for now) when I limit my searching to my friends photos.  Using API feeds I can now build an ego feed of photos from my friends, like so:</p>
<pre><code>flickr.photos.search:
   user_id =&gt; 51035734193@N01,
   contacts =&gt; all,
   text =&gt; kellan,
   sort =&gt; date-posted-desc,
   api_key =&gt; {API_KEY}
   auth_token =&gt; {AUTH_TOKEN}
   format =&gt; feed-atom_10

api.flickr.com/services/rest/?auth_token=xxxx&amp;user_id=51035734193%40N01&amp;
   contacts=all&amp;format=feed-atom_10&amp;sort=date-posted-desc&amp;text=kellan
   &amp;api_key=xxxx&amp;method=flickr.photos.search&amp;api_sig=xxxx
</code></pre>
<h3 id="putting_it_together_near_home">Putting it together: near home</h3>
<p>Or a KML feed of the most interesting, safe, CC licensed photos, within 10 kilometers of a point (say your home), suitable for remixing:</p>
<pre><code>flickr.photos.search:
   license =&gt; 1,2,4,5,7,
   sort =&gt; interestingness-desc,
   lat =&gt; 40.661699,
   lon =&gt; -73.98947,
   radius =&gt; 10,
   safe_search =&gt; 1,
   api_key =&gt; {API_KEY}
   format =&gt; feed-kml

api.flickr.com/services/rest/?auth_token=xxx&amp;license=1%2C2%2C4%2C5%2C7&amp;
  lat=40.661699&amp;lon=-73.98947&amp;radius=10&amp;safe_search=1
  &amp;format=feed-atom_10&amp;api_key=xxxx&amp;method=flickr.photos.search
  &amp;api_sig=xxxxx
</code></pre>
<p>You get the idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.flickr.com/blog/2008/08/25/api-responses-as-feeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
