maintaining multiple API versions

Hi.

What's beautiful about Rails is that it provides the incredibly easy
system for API building.

At the same time once you grow and production test the application you
start finding that you can make the API interface even better. But you
have to break backward compatibility.

How do you handle this situation?

I was initially planning something like DNS versioning and multiple
rails deployments (api01.startup.com, api05.startup.com). This plan
won't work anymore since there are cases when we will controlling the
code, but not the deployment server and DNS setup.

What's the best way to implement API versioning in rails?

What's the best way to implement API versioning in rails?

With routing.

Start off with api.startup.com/v1/session/create, then move on to
api.startup.com/v2/session/create, etc.

- D

With routing.

Start off with api.startup.com/v1/session/create, then move on to
api.startup.com/v2/session/create, etc.

Interesting. That would be a pretty solution.

What's the best way to provide backwards compatibility using this
model? Should I have XML views that implement:
if version1
  do this
else
  do that