Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Versioning APIs with ASP.NET Core 2.1

142 views

Published on

In this talk, I show people how to version their APIs with ASP.NET Core 2.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Versioning APIs with ASP.NET Core 2.1

  1. 1. Versioning APIs With ASP.NET Core 2.1 Shawn Wildermuth Microsoft MVP, Speaker, and Filmmaker https://wildermuth.com @shawnwildermuth
  2. 2. Who Am I? Author, Instructor, Coach Pluralsight Author > 20 Courses to my name http://shawnw.me/psauthor Wilder Minds Training Courses on Vue, Bootstrap 4 & Font Awesome http://shawnw.me/my-courses Making a Film Hello World Film http://helloworldfilm.com
  3. 3. What Is API Versioning? Once you publish, It’s Set in Stone Users rely on the API not changing But requirements will change Evolve the API without breaking clients API Versioning isn't Product Versioning Don't tie them together
  4. 4. The Problem with API Versioning In typical projects Versioning is accomplished with different versions of the package E.g. Assemblies API versioning is harder Your API needs to support both new and old users Side-by-side deployment isn't feasible most of the time Need to support both versions in same code base
  5. 5. API Versioning Schemes There are lots of ways to version an API Not all of them are recommended If you find a mechanism that works for you that’s all that matters But remember that you’re serving your clients, not yourselves
  6. 6. Versioning in the URI // URI Path https://foo.org/api/v2/Customers // Query String https://foo.org/api/Customers?v=2.0
  7. 7. Versioning with Headers GET /api/camps HTTP/1.1 Host: localhost:44388 Content-Type: application/json X-Version: 2.0
  8. 8. Versioning with Accept Header GET /api/camps HTTP/1.1 Host: localhost:44388 Content-Type: application/json Accept: application/json;version=2.0
  9. 9. Versioning with Content Type GET /api/camps HTTP/1.1 Host: localhost:44388 Content-Type: application/vnd.yourapp.camp.v1+json Accept: application/vnd.yourapp.camp.v1+json
  10. 10. Demo Versioning APIs
  11. 11. Takeaways… Important Links My Blog https://wildermuth.com ASP.NET Core https://dot.net ASP.NET Core’s Source: https://github.com/aspnet/home

×