timandkathy.co.uk

Simon Willison: Ajax and the Flickr API

  • Flickr: totally buzzword compliant (“Social software, Tags/Folksonomies, Web Services, Ajax”)
  • The developers said: “we wouldn’t trust a service with no export option”
  • Don’t want to build an export tool
  • Built an API instead - let the users build an export tool
  • No-one’s built one yet, though they have built loads of other cool things
  • Related tags browser
  • Flickr upload tools: iPhoto plugin; various Linux ones; FlickrFS - virtual filesystem for Linux!
  • The ultimate geo-spatial mashup! magic tags in photos: geo-long, geo-lat, geotagged XXX

Web services

  • Lets software talk to other software over the web
  • SOAP and XML-RPC - magic function calls
  • REST
  • Flickr API calls made by sending named parameters to an endpoint
  • Required: method, api_key
  • All data is expected to be UTF-8, if not, it’s converted from iso-8859-1
  • Public, private and authentication-dependent methods
  • API Explorer
  • Community API kits in various languages

Scrumjax! (Flickr’s own buzzword)

  • Inline editing - titles, descriptions, tags
  • Notes
  • Misc. niceties
  • All uses the public web services API!! (Martin: this is SOA on speed…)
  • They’re eating their own dogfood :)
  • Firefox LiveHttpHeaders extension is useful for debugging Ajax apps.

Benefits of adding web services to apps

  • User trust
  • External innovation & creativity
  • Encourages better app design
  • XMLHttpRequest and REST make a great combination
  • www.flickr.com/services/
  • If you only want read-only, there are also RSS feeds

Audience questions

  • What percentage of usage is via the API? Not sure, but Flickr is the biggest user of its own API.
  • How much load is introduced by exposing the API? Absolutely loads, as some queries are really expensive.
  • How has the API design evolved? Simon’s only been there three weeks, but he thinks the API has been there from very early on.
  • Server-side tech? PHP/MySQL (!). Loads of caching used, plus some java to distribute photos between servers. Performance-intensive stuff in C/C++.
  • Organizr uses the API? Yes, but the XML-RPC version.
  • What stops someone building their own site on top? API keys, and Ts&Cs