Ninjas on a Penny Farthing

Use Twitter? Follow on Twitter.

API Driven Applications with Rails

Last weekend in Singapore, I got a chance to present on a topic I love – Building APIs with Ruby. For the sake of those who were interested but unable to attend, I’ve uploaded my slides as well as a list used in the presentation (including some extras as requested).

Resources in the presentation

  • Efficient Validation – How you can minimize the amount of work your application needs to implement. Implemented in RocketPants as part of RocketPants::Cacheable and RocketPants::CacheMiddleware.
  • Grape – A tool similar to Sinatra but for building APIs. Built on top of Rack with minimal dependencies.
  • Rails::API – Rails minus the stuff not needed for building apis.
  • Rocket Pants – My own attempt at making it easier to build APIs in Rails.
  • Apigee Console – A set of consoles for experimenting with different APIs.
  • JSONView – An extension for Chrome to make it easy to interact with JSON and JSONP apis. Super useful when testing APIs from within a browser.
  • The Twitter API – An example of a well built API that mixes new and old functionality. Also, some of the best documentation I’ve encountered.
  • The Echonest API – A well designed API built around music metadata an example of nice to use documentation.
  • API Smith – My set of tools to make constructing clients for APIs easier.
  • Designing Hypermedia APIs – An excellent book / site by Steve Klabnik on how to build well designed, hypermedia apis. An excellent place to start, even if you decide not to build a hypermedia api.
  • My thoughts on Versioning – As promised, my thoughts on URI based versioning versus header based versioning.

Other Resources to check out

A few people at the conference asked about other resources to check out / play with, and hence I’ve compiled the following list of useful tools that I found useful:

  • A chat with Viki on API Dev – I caught up with the team at Viki on the monday after the conference and they were kind enough to transcribe and post their notes that came out of that discussion.

Other APIs

  • The SoundCloud API – A good example of a well designed api that is both simple to interact with and well documented. In particular, I like the use of resolve to normalise a url into an object.
  • The GitHub API – A great example of a well desined, easy to use API. Makes use of the Link http header along with other well guide design principles to make it enjoyable to use.

API Dev Tools

  • I/O Docs – A tool courtesy of Mashery that makes it simple to build interactive API documentation.
  • Mashery – Provides services and infrastructure around hosting APIs.
  • Apigee – Similar to Mashery.

OAuth2 Tools

  • Opro – OAuth2 Server implemenetation by @schneems.
  • rack-oauth2-server – One of the more mature and fully implemented OAuth 2 providers, implemented using Rack.
  • Rails Oauth Plugin – Another option, supporting both OAuth 1.0 and OAuth 2.

Tools to test APIs

  • httpie – An excellent command line tool for testing APIs – Gives a simple, HTTP-friendly way to interact and highlights responses as appropriate.
  • HTTP Client – Similar to httpie, but as an app.
  • Hurl – Again, similar, but this time web based.