DEV Community

Cover image for API Versioning in .Net Core.
Vaibhav Lande
Vaibhav Lande

Posted on

API Versioning in .Net Core.

What is API versioning

  • API versioning helps you to manage and maintain different versions of endpoints.
  • It allows the developer to add new functionality instead of changing the existing ones as some clients rely on an older version

Common ways to implement API versioning

Implement URL versioning

  • Create Project with .NetCore web api template

  • Install Nuget packages
    Asp.Versioning.Mvc : Required for MVC controller end Point and
    Asp.Versioning.Mvc.ApiExplorer: Required for ASP.NET Core API Versioning.

Image description

  • Use AddApiVersioning to provide options for API versioning ApiVersioningOptions.

Image description
Added the definition of each line in the comment (refer to the above snapshot).

  • At the controller level specify the supported API version.

Image description

  • Postman Result

Image description

Image description

😍 If you enjoy the content, please 👍 like, 🔄 share, and 👣 follow for more updates!
Join me on a professional journey through my LinkedIn profile: Vaibhav Lande

Top comments (0)