Jadala Ajay
2 min readOct 5, 2023

I have recently come across API versioning in my previous project during restructuring of the APIs to accommodate a few business requirements.

Sharing the things that I learned while versioning so that useful for you.

What is API Versioning:

The process of generating and maintaining various API versions in order to maintain backward compatibility while making changes to the API is known as API versioning. It enables programmers to modify the API without disrupting already-in-use integrations that rely on the API.

Versioning of APIs is crucial because changes to the APl may affect how clients utilize it. Any modifications to the API’s behaviour may cause a breaking change if a client depends on that behaviour. Clients can utilize an older version of the API up until they are ready to switch to a newer one thanks to versioning.

Ways to implement API versioning:

Below are the various methods to achieve API versioning.

  1. URL versioning: The API version is included in the URL. Clients can continue to use the older URL until they are ready to migrate to the newer version. Ex: https://api.example.com/v1/library to https://api.example.com/v2/library
  2. Header versioning: The API version is included in the HTTP headers. Clients can specify the version they want to use in the request headers.
  3. Query param versioning: The API version is included as the query params Ex:https://api.example.com/v2/library?version=v1
  4. Content negotiation versioning: This approach versions resources based on their representational state/media type.

Each approach has pros and cons, and the choice depends on factors such as API complexity, business requirements and compatibility considerations.

We should go for APl versioning in below cases:

  1. Payload changes
  • Structure changes (addition or removal of params)
  • Change in type of body param for ex: integer to string
  • Renaming a param
  1. 2. Change resource path

3. Protocol change (ex: REST to GraphQL)

4. Content type changes (ex XML to JSON)

What is the scope of testing for API versioning?

  1. To test the functionality of the new versioning APls as per the changes.
  2. To Perform the Version compatibility testing against all the existing integrations.
  3. To perform Interoperability testing to make sure data should still be rendered regardless of the Ul and API versions that are being used.
  4. Performance Testing to make sure the new versioning does not degrade the existing expected performance.
  5. Security Testing

Automation testing plays a pivotal role in testing API versioning to identify the compatibility issues breaking functionality issues quickly.

Jadala Ajay

8 Years Exp Senior Automation Engineer with expertise on Selenium,RestAsured API,Postman,Cypress,WebdriverIO with prog languages Java,Javascript and Python