So I've spent the past few hours trolling through all the genuinely fantastic advice for Web API Versioning. Some of my favourites, for those having as much fun as I am, in no particular order:
Best practices for API versioning?
Versioning REST API of an ASP.NET MVC application
http://www.troyhunt.com/2014/02/your-api-versioning-is-wrong-which-is.html
http://www.pluralsight.com/courses/web-api-design
http://www.pluralsight.com/courses/implementing-restful-aspdotnet-web-api
So all this advice has been very helpful in designing what is essentially the "front end" of the API. We can version the API calls... Now, I'm on to the hard part.
This is a heavily data driven application, for a company with several products (this is a new one) doing monthly releases. Some big customers who will want long-term support for API calls, some smaller customers who will want the latest releases. This we could manage with something similar to milestone/long-term-support releases of the API. Great.
But in practice this is going to get really messy, really fast. We've worked hard to separate out the layers of our own website, the beta Internal/External APIs, Repository Layers and even an SDK to boot. We separate out each release out into separate branches, but it's SAAS - we host the database. So we're not just going to be able to version the API calls - but everything underneath that. The Business Logic, Repository and the Database. Let's not even get started on Unit/Integration Testing.
So, trying and probably failing only ask one question here.
Is there a decent pattern for structuring a layered, data-driven, .NET application to cope with multiple versions?
Specifically how the database will change and how you can structure a generic stack to version it all. Some ideas I have include:
- Updating old source control branches of the stack and deploying these
- Keeping everything in the same project, but use folders/namespacing all the way down
- Splitting the projects further - so the API solution has a number of "Controller" projects, with similar concepts for the logic/repo layers
We have a fair number of developers and no matter how much ace documentation I write, realistically it will only be read when something isn't working. So ideally it needs to be as glaringly obvious as possible for developers to get this right.