Reputation: 73
Need a way\design to develop multiple version of java spring rest api for example: exampleAPiV1,exampleAPiV2,exampleAPiV3
all 3 api version's should be live at the same time. Also if there is need for bug fix\enhancement in a particular version, the changes do not impact other version with Zero or minimum code duplication.
Upvotes: 0
Views: 264
Reputation:
For API versioning there are 3 ways:
expose API version in the URL example:
http://api.example.com/v1/examples
http://api.example.com/v2/examples
Using Accept Header, Accept: application/json+v1
Regarding to the code, you may use the routes/headers in order to execute the corresponding functionality.
I mean in certain point of your application(middle-wares) or before actions you can get the version value from the URL or from the header and based on the value you call the functionality.
Upvotes: 1