We run an API with probably 20 registered consumers, supporting apps and websites with different versions. This is not by any means an example of "the one true way", but it seems to be working well for us.
Basically, we put together a simple wrapper that lets us automatically pick which API version to use based on a users apikey, registered version (I set them up with v1 or v2), and what they pass in. A before_filter automatically pulls the apikey and version from params/headers, and it's consumed like this:
Basically, we put together a simple wrapper that lets us automatically pick which API version to use based on a users apikey, registered version (I set them up with v1 or v2), and what they pass in. A before_filter automatically pulls the apikey and version from params/headers, and it's consumed like this:
https://gist.github.com/kingcu/1e5e6982ad3e05707303
Essentially this lets us be strict about what key gets what result, and, lets us do prioritized fallback logic by using the any() function shown.