Re:Considerations When Planning Endpoints for your RESTful API
by div on Wednesday October 19, 2011 @06:13AM
(#3129476)
Having versioning information in the headers should be as obvious as having it in the url when you are writing code that interfaces with the rest api.
Url based versioning is only more visible if you are accessing the api through a browser, in which case it's probably fine for the api to return the latest version since humans are pretty good at making sense out of new representations.
I'm not sure I understand the benefit of url partials based routing. A REST api should be easily loadbalanced using a simple round robin setup since no state lives longer than a single request.
Edit: Ok yeah, url partial based routing will allow you to implement v2 as an entirely new system.
When I try to think of some of the nicest APIs I have actually used, I don't recall them being 100% REST compliant.
I am still not sold on putting versioning in the headers. Url based versioning has the benefit that the version being used is readily apparent (visible), as well as easing scalability due to the ability of frontend proxies to route based on url partials. The pragmatist in me says url versions are 'ok'. Maybe not the best, but as a trade-off "good enough" if it makes implementing them easier.
[1]: http://nordsc.com/ext/classification_of_http_based_apis.html