SlideShare a Scribd company logo
1 of 14
Versioning APIs with ASP.NET Core
Shahriar Hossain
@shossain_tweet
#ASP.NET Core #Versioning
 Software Engineer & Consultant
 Microsoft MVP
 Tech Event Organizer
 Tech Blogger
Shahriar Hossain
What is API versioning ?
When to do API versioning ?
 Side by Side deployment not feasible
 Need to Support both versions by Code
Types of API versioning ?
• URI Path
• Namespace
• Query String
Versioning with URI
• Custom Header
• Accept Header
Versioning with Header
• Content Type
Versioning with ContentType
• Custom Reader/Resolver
Other approach
Versioning with URI
Query String:
 /api/foo
 /api/foo?api-version=1.0
 /api/foo?api-version=2.0-Alpha
 /api/foo?api-version=2019-02-02
 /api/foo?ver=2019-02-02
URI Path:
 /api/v1/foo
 /api/v2/foo
Versioning with Header
Custom Header:
 GET /api/foo HTTP/1.1
 Host : localhost: 5000
 Content-Type: Application/json
 X-Version: 2.0
Accept Header:
 GET /api/foo HTTP/1.1
 Host : localhost : 5000
 Content-Type : Application/json
 Accept : application/json; version = 2.0
Versioning with Content-Type
 GET /api/foo HTTP/1.1
 Host : localhost : 5000
 Content-Type : application/vnd.haveibeenpwned.v2+json
 Accept : application/vnd.haveibeenpwned.v2+json
Required Package
DEMO
Community Group
Microsoft Azure Bangladesh
• group: www.facebook.com/groups/microsoft.azure.bd
• page: fb.com/microsoft.azure.bd
Asp.Net - Bangladesh
• www.facebook.com/groups/asp.net.mvc.bd
Do you have any
Question?
Shahriar
Hossain
Facebook
Personal Blog
LinkedIn
http://LearnWithShahriar.wordpress.com
Thank You

More Related Content

More from Shahriar Hossain

Cross platform app development with xamarin.forms
Cross platform app development with xamarin.formsCross platform app development with xamarin.forms
Cross platform app development with xamarin.formsShahriar Hossain
 
Middleware in Asp.Net Core
Middleware in Asp.Net CoreMiddleware in Asp.Net Core
Middleware in Asp.Net CoreShahriar Hossain
 
Microsoft bot framework in azure
Microsoft bot framework in azureMicrosoft bot framework in azure
Microsoft bot framework in azureShahriar Hossain
 

More from Shahriar Hossain (8)

Cross platform app development with xamarin.forms
Cross platform app development with xamarin.formsCross platform app development with xamarin.forms
Cross platform app development with xamarin.forms
 
Azure IoT Hub
Azure IoT HubAzure IoT Hub
Azure IoT Hub
 
Microsoft Azure Overview
Microsoft Azure OverviewMicrosoft Azure Overview
Microsoft Azure Overview
 
Intro to cloud computing
Intro to cloud computingIntro to cloud computing
Intro to cloud computing
 
Intro to Azure Webjobs
Intro to Azure WebjobsIntro to Azure Webjobs
Intro to Azure Webjobs
 
Middleware in Asp.Net Core
Middleware in Asp.Net CoreMiddleware in Asp.Net Core
Middleware in Asp.Net Core
 
Microsoft bot framework in azure
Microsoft bot framework in azureMicrosoft bot framework in azure
Microsoft bot framework in azure
 
Asp net core in azure
Asp net core in azureAsp net core in azure
Asp net core in azure
 

Recently uploaded

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Versioning in asp.net core

  • 1. Versioning APIs with ASP.NET Core Shahriar Hossain @shossain_tweet #ASP.NET Core #Versioning
  • 2.  Software Engineer & Consultant  Microsoft MVP  Tech Event Organizer  Tech Blogger Shahriar Hossain
  • 3. What is API versioning ?
  • 4. When to do API versioning ?  Side by Side deployment not feasible  Need to Support both versions by Code
  • 5. Types of API versioning ? • URI Path • Namespace • Query String Versioning with URI • Custom Header • Accept Header Versioning with Header • Content Type Versioning with ContentType • Custom Reader/Resolver Other approach
  • 6. Versioning with URI Query String:  /api/foo  /api/foo?api-version=1.0  /api/foo?api-version=2.0-Alpha  /api/foo?api-version=2019-02-02  /api/foo?ver=2019-02-02 URI Path:  /api/v1/foo  /api/v2/foo
  • 7. Versioning with Header Custom Header:  GET /api/foo HTTP/1.1  Host : localhost: 5000  Content-Type: Application/json  X-Version: 2.0 Accept Header:  GET /api/foo HTTP/1.1  Host : localhost : 5000  Content-Type : Application/json  Accept : application/json; version = 2.0
  • 8. Versioning with Content-Type  GET /api/foo HTTP/1.1  Host : localhost : 5000  Content-Type : application/vnd.haveibeenpwned.v2+json  Accept : application/vnd.haveibeenpwned.v2+json
  • 10. DEMO
  • 11. Community Group Microsoft Azure Bangladesh • group: www.facebook.com/groups/microsoft.azure.bd • page: fb.com/microsoft.azure.bd Asp.Net - Bangladesh • www.facebook.com/groups/asp.net.mvc.bd
  • 12. Do you have any Question?

Editor's Notes

  1. What is api versioning? When to do versioning? Different approaches?
  2. In a typical project, versioning is accomplished with diff versions of the package i.e assemblies ITS NOT Product versioning…. API versioning is harder as you need to support both old and new user
  3. Common misconception: Versioning needs to bake into APIs from the very first day of your project. Target : Evolve the API without breaking the client
  4. There are lots of way to do versioning…
  5. Query String: MESSY but easy URI segment : - Not good for existing project. - Default api version is not possible - What if an API don’t have v1 ? Restful compliance not follow, URI should represent resource, not version!