Skip to main content

Digital Transformation

How to do API Versioning

1- URL based versioning

Easy and very common way to version api is to include version no in api url.
For e.g. http://myapi/v1.0.0 , http://myapi/v1.0.1

  • Easy to use and identify different version by looking URL.
  • Over time need to maintain various urls

2- Using query param

Another easy to use startegy for api versioning
For e.g. http://myapi?version=1.0.0

  • Same url for different api version
  • Need to add tranformation logic to route to particular version

3- Using custom HTTP header

Slight advantage over approach #2 since this will keep url short.

  • same url for different api version
  • Need to add tranformation logic to route to particular version

4- Using Accept HTTP Header

For e.g. Accept:application/v1.0.0+json , Aceept:application/v1.0.0+json

Slight advantage over approach #3 since no need to add new custom header.

  • Same url for different api version
  • Need to add tranformation logic to route to particular version

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Susheel Kumar

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram