The Flickr Developer Blog has posted an interview with Simon Willison co-creator of the Django Web framework and one of the developers of the sophisticated Flickr mashup WildlifeNearYou.com. The project took around 14 months to complete, and Simon shares some of the tips and tricks he picked up during that time working with the Flickr API.
Flickr machine tags featured heavily in the tips:
Here's a fun example: finding all of the Red Pandas that have been spotted in Europe. WildlifeNearYou doesn't yet have a concept of Europe, but Flickr's API can search using Yahoo! WhereOnEarth IDs. We can find the WOEID for Europe using the GeoPlanet API: http://where.yahooapis.com/v1/places.q('europe')?appid=[yourappidhere]
The WOEID for Europe is 24865675. Next we need the WildlifeNearYou identifier for red pandas, so we can figure out the correct machine tag to search for. We re-use the codes from our custom URL shortener for our machine tags, so we can find that ID by looking for the "Short URL" link on http://www.wildlifenearyou.com/animals/red-panda/ (at the bottom of the right hand column). The short URL is http://wlny.eu/s2f which means the machine tag we need is wlny:species=s2f
Armed with the WOEID and the machine tag, we can compose a Flickr search API call:
That gives us back a list of photos of Red Pandas taken in places that are within Europe.
The interview also asks what Flickr could add or do better, to which Simon replied he would like to see an OAuth-style flow for selecting photos:
I’d like to (for example) redirect my users to somewhere like
http://www.flickr.com/pickr/?return_to=http://www.wildlifenearyou.com/selected/and have Flickr present them with a full UI for searching and selecting from their photos. Once they had selected some photos, Flickr could redirect them back to
http://www.wildlifenearyou.com/selected/?photo_ids=4303651932,4282571384,4282571396and my application would know which photos they had selected.
This would make integrating “pick a photo / some photos from Flickr” in to any application much, much easier.
WildLife Near You was previously featured in the Flickr blog, which you can find here.
The interview is an interesting read, and those using the Flickr API are likely to pick up something new. For more examples of the Flickr API in action visit our Flick API profile, which lists over 500 Flickr mashups.