Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Versioning APIs in ASP.NET Core 2.1

306 vues

Publié le

In this talk, I show different ways to version your APIs and the new facility in ASP.NET Core to simplify how you apply versioning to your projects.

Publié dans : Technologie
  • Soyez le premier à commenter

Versioning APIs in ASP.NET Core 2.1

  1. 1. Shawn Wildermuth Microsoft MVP, Author, and Speaker https://wildermuth.com @shawnwildermuth Versioning APIs With ASP.NET Core 2.1
  2. 2. Who Am I? Instructor Over twenty courses for Pluralsight http://shawnw.me/psauthor Three Courses for Wilder Minds Training http://courses.wilderminds.com Documentary Making a movie about Developers 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