<?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; blogging</title>
	<atom:link href="http://code.flickr.com/blog/tag/blogging/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>Twitter in the API</title>
		<link>http://code.flickr.com/blog/2009/06/30/twitter-in-the-api/</link>
		<comments>http://code.flickr.com/blog/2009/06/30/twitter-in-the-api/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 20:12:23 +0000</pubDate>
		<dc:creator>kellan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://code.flickr.com/blog/?p=957</guid>
		<description><![CDATA[


photo by mocachip


Ever since we launched our Flickr2Twitter beta, developers have been requesting new API methods, so they can support Flickr as a photo sharing option in their Twitter clients.
I&#8217;ve got good news, and bad news.
The bad news is we don&#8217;t have any new APIs to offer you.
The good news is we shipped our &#8220;Twitter [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-top:20px;margin-bottom:30px;">
<a href="http://www.flickr.com/photos/87331483@N00/3486881225/" title="Mission 24:  Yesterday by mocachip, on Flickr"><img src="http://farm4.static.flickr.com/3612/3486881225_87f089526d.jpg" width="500" height="326" alt="Mission 24:  Yesterday" style="border:1px dotted #ccc;padding:5px" /></a></p>
<div style="text-align:right;font-size:small;margin-right:20px;">
<a href="http://www.flickr.com/photos/87331483@N00">photo by mocachip</a>
</div>
</div>
<p>Ever since we launched our <a href="http://www.flickr.com/groups/flickrtwitterbeta/">Flickr2Twitter beta</a>, developers have been requesting new API methods, so they can support Flickr as a photo sharing option in their Twitter clients.</p>
<p>I&#8217;ve got good news, and bad news.</p>
<p>The bad news is we don&#8217;t have any new APIs to offer you.</p>
<p>The good news is we shipped our &#8220;Twitter APIs&#8221; nearly five years ago.</p>
<p>Let me explain.</p>
<h3 id="working_with_blogs_including_twitter">Working with Blogs (including Twitter)</h3>
<p>For as long as anyone can remember, we&#8217;ve supported the option of posting to external blogs directly from Flickr. Once you&#8217;ve conﬁgured a blogging service it becomes available in the “Blog This” drop down, as an option for Upload by Email, and, of  course, in the API.</p>
<p>You and I might have serious philosophical questions about whether Twitter is a blogging service, but our web servers are more pragmatic. To them, the Twitter integration is just a new blogging service.</p>
<h3 id="configuring_a_blogging_service">Configuring a blogging service</h3>
<p>The first step for a member wishing to blog (or tweet) via Flickr is to configure an external blog.  The only way to do this on <a href="http://flickr.com">flickr.com</a>, generally from the <a href="http://www.flickr.com/account/blogs/add/">Add a blog</a> page.</p>
<p>Twitter is a bit special (or rather a preview of things to come) as we&#8217;ve given it its own <a href="http://www.flickr.com/services/twitter/">service page</a>.  Directing users of your app to the <a href="http://www.flickr.com/services/twitter/">Flickr2Twitter page</a> is probably the best way get them &#8220;tweet ready&#8221;.</p>
<h3 id="all_ready">All set?</h3>
<div style="margin-top:20px;margin-bottom:30px;">
<a href="http://www.flickr.com/photos/rckmsckm/2599195330/" title="THE FORTUNE WITHIN by RCKM ©®™, on Flickr"><img src="http://farm4.static.flickr.com/3056/2599195330_c9e3a34126.jpg" width="500" height="333" alt="THE FORTUNE WITHIN" style="border:1px dotted #ccc;padding:5px" /></a></p>
<div style="text-align:right;font-size:small;margin-right:20px;">
<a href="http://www.flickr.com/photos/rckmsckm">photo by RCKM ©®™</a>
</div>
</div>
<p>From here on out, you&#8217;ll need your user to have authorized you to access their Flickr account. (<a href="http://www.flickr.com/services/api/misc.userauth.html">Find out more about FlickrAuth</a>)</p>
<p>With a signed call to <a href="http://www.flickr.com/services/api/flickr.blogs.getList.html">flickr.blogs.getList()</a> you can get a list of all the blogging services a member has configured.  Alternately you can pass in a <code>service</code> id (e.g. <code>Twitter</code>) to scope the list of blogs to the service you&#8217;re interested in.  The response looks something like:</p>
<pre><code>&lt;blogs&gt;
  &lt;blog id="7214" name="Code Flickr" service="MetaWeblogAPI" needspassword="0" url="http://code.flickr.com/blog/"/&gt;
  &lt;blog id="7215" name="Twitter: kellan" service="Twitter" needspassword="0" url="http://twitter.com/kellan"/&gt;
  &lt;blog id="72157" name="Twitter: Flickr" service="Twitter" needspassword="0" url="http://twitter.com/flickr"/&gt;
&lt;/blogs&gt;
</code></pre>
<p>This account has 3 blogs configured.  A <a href="http://wordpress.org">Wordpress</a> blog, and two <a href="http://twitter.com">Twitter</a> accounts.  Each one has a unique id.  Additionally <code>needpassword="0"</code> means we have credentials for these blogs stored server side and you don&#8217;t need to prompt your user to log in to their blog.</p>
<p>If you passed in <code>Twitter</code> as the service, and instead of the above you got something like:</p>
<pre><code>&lt;blogs/&gt;
</code></pre>
<p>Then your user hasn&#8217;t configured any blogs for that service.</p>
<h3 id="the_easy_option_upload_a_photo_to_flickr_post_to_twitter_via_flickr">The Easy Option: Upload a photo to Flickr, post to Twitter via Flickr</h3>
<p>If your application has been authorized to upload photos on your user&#8217;s behalf, and you&#8217;ve made sure they have a Twitter blog configured with Flickr, then the easiest solution is to use Flickr as a passthru service.  </p>
<p>Once you&#8217;ve successfully uploaded a photo you&#8217;ll get an API response like <code>&lt;photoid&gt;1234&lt;/photoid&gt;</code>.  (Find out <a href="http://www.flickr.com/services/api/upload.api.html">more about uploading</a> and <a href="http://www.flickr.com/services/api/upload.async.html">asynchronous uploading</a>).  </p>
<p>Pass the <code>blog id</code> from the <code>&lt;blogs&gt;</code> list above, and the <code>photoid</code> from the upload response to <a href="http://www.flickr.com/services/api/flickr.blogs.postPhoto.html">flickr.blogs.postPhoto()</a>.  If you&#8217;re posting to Twitter the <code>title</code> argument is optional and the <code>description</code> argument is ignored. (By default the title of the photo is the body of the tweet, alternately pass a different status update in the <code>title</code> field)</p>
<p>Or instead of passing a blog id, you can pass a service id (i.e. <code>Twitter</code>) and the photo (and blog post) will be sent to the first matching blog of that service.  If we don&#8217;t find a blog matching that service, you&#8217;ll get a &#8220;<code>Blog not found.</code>&#8221; error.</p>
<p>Assuming your API call to <a href="http://www.flickr.com/services/api/flickr.blogs.postPhoto.html">flickr.blogs.postPhoto()</a> is well formed, Flickr will turn around and post your user&#8217;s tweet to <a href="http://twitter.com">Twitter</a>, including a <a href="http://www.flickr.com/services/api/misc.urls.html#short">short flic.kr url</a> linking back to their photo.</p>
<div style="margin-top:20px;margin-bottom:30px;">
<a href="http://www.flickr.com/photos/tonyadcock/3011228073/" title="I cant read, but the cookie is good by tonyadcockphotos, on Flickr"><img src="http://farm4.static.flickr.com/3178/3011228073_e9f24ce543.jpg" width="500" height="400" alt="I cant read, but the cookie is good" style="border:1px dotted #ccc;padding:5px" /></a></p>
<div style="text-align:right;font-size:small;margin-right:20px;">
<a href="http://www.flickr.com/photos/tonyadcock/">photo by tonyadcockphotos</a>
</div>
</div>
<h3 id="the_established_option_upload_a_photo_flickr_post_to_twitter_any_which_way_you_can">The Established Option: Upload a photo Flickr, post to Twitter any which way you can</h3>
<p>If you&#8217;re looking to integrate Flickr photos into an existing Twitter application you might already have a preferred method for posting to Twitter.  </p>
<p>After you&#8217;ve <a href="http://www.flickr.com/services/api/upload.api.html">successfully uploaded a photo</a> and received the <code>photoid</code> follow these <a href="http://www.flickr.com/services/api/misc.urls.html#short">instructions for manufacturing a short url</a> using the <a href="http://flic.kr">flic.kr</a> domain.</p>
<p>Unlike most URL shortening schemes, every photo on Flickr already has a short URL associated with it. The follow the form:</p>
<pre><code>http://flic.kr/p/{base58-photo-id}
</code></pre>
<p>By the way, you shouldn&#8217;t feel constrained to only use short urls on Twitter.  They work equally well for a diverse range of applications including fortune cookies.</p>
<h3 id="thumbnails">Thumbnails</h3>
<p>If you want to display a thumbnail of a photo, you&#8217;ll need to make an API call to one of the methods that returns the photo&#8217;s secret.  Either <a href="http://www.flickr.com/services/api/flickr.photos.getSizes.html"> flickr.photos.getSizes()</a> or <a href="http://www.flickr.com/services/api/flickr.photos.getInfo.html">flickr.photos.getInfo()</a> will do.  Read up <a href="http://www.flickr.com/services/api/misc.urls.html">on constructing Flickr URLs</a>.</p>
<h3 id="follow_along">Follow Along</h3>
<p>My favorite new game has been watching the <a href="http://search.twitter.com/search?q=flic.kr+source%3AFlickr">flows of shared Flickr photos</a> as they appear on Twitter.</p>
<p>Happy photo sharing!</p>
]]></content:encoded>
			<wfw:commentRss>http://code.flickr.com/blog/2009/06/30/twitter-in-the-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
