REST API versioning in Go
Table of content
Conclusion
My experience with this approach is that it is easy to maintain, easy to update, and keeps things nicely organized.
I will use this approach for all my REST APIs because I think it is important that we strive to optimize the APIs while maintaining stability, so clients are not breaking immediately just because the API has been updated.
This also allows an old version to still be productive code, which can be updated and optimized.
One thing I still have to work on is how I can make it easier to see how to migrate to a new version. Currently, I get notified that I have to update, but when I upgrade from e.g. "/api/v2" to "/api/v3", I have to check each API call to see if the call is still correct.
Maybe you'll figure it out while trying to reproduce this architecture. Have fun coding!