DEV Community

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

Posted on

2

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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay