#td17ch
Building HTTP APIs with
ASP.NET Core
Filip Wojcieszyn
Tech Lead CloudServices, Sonova
@filip_woj
strathweb.com
sonova.com
Before ASP.NET Core
 HTTP Handlers
 ASMX
 WCF Web Http | WCF REST Starter Kit
 ASP.NET MVC
 WCF Web API | ASP.NET Web API
Building HTTP APIs with ASP.NET Core
Agenda
Plan for today
 Lightweight HTTP APIs
 Security
 Documentation
 Versioning
 Demos
https://github.com/filipw/aspnetcore-api-samples
Lightweight HTTP APIs
What would Martin Fowler do?
Building HTTP APIs with ASP.NET Core
Building HTTP APIs with ASP.NET Core
Source: https://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/
Lightweight APIs with ASP.NET Core
Prefer the IRouter extensions
Super lightweight - modeled after other platforms - e.g. Node, Go, Swift
Use MVC for more complex backends
Don’t unnecessarily rely on the full framework
When using MVC, pick and choose pieces you
need
AddMvcCore() method allows you to add only most basic framework services
Super
lightweight
Whole API in single C# file
No MVC
Minimal footprint
How To Not Set Up an MVC-based API
How To Set Up an MVC API
Security
HTTP API Security
Use JSON Web Tokens (JWT)
IdentityServer4 is the most popular OpenID Connect and OAuth 2.0 framework for
ASP.NET/ASP.NET Core
Tokens can be issued from an embedded server
too
API could act both as identity and resource server at the same time
ASP.NET Core introduces “Authorization Policies”
Centralized way to define required claim validations
Building HTTP APIs with ASP.NET Core
Securing an API (embedded server)
Documentation
HTTP API Documentation
Swagger has become a de facto standard
Defines swagger.json descriptor file, that allows easy client generation
Swashbuckle package for ASP.NET Core
Can generate swagger.json for your MVC-based HTTP API
ASP.NET Core MVC exposes IApiExplorer service
In case you need to manually traverse the endpoints
Building HTTP APIs with ASP.NET Core
Building HTTP APIs with ASP.NET Core
Building HTTP APIs with ASP.NET Core
Versioning
Versioning is difficult
HTTP API Versioning Approaches
URI-based
GET /v1/contacts
GET /contacts?v=1
Header-based
GET /contacts
Version: 2
Media type-based
GET /contacts
Accept: application/vnd.contact-v2+json
HTTP API Versioning packages
Microsoft.AspNetCore.Mvc.Versioning
A Microsoft versioning package for ASP.NET Core MVC
WebApiContrib.Core.Versioning
A community versioning package for ASP.NET Core MVC
© 2017 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and
Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
© 2017 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and
Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related Content

PPTX
ASP.NET Core MVC + Web API with Overview
PPTX
The Universal Programming Language: C#
PPTX
ASP.NET Core MVC + Web API with Overview (Post RC2)
PPTX
ASP.NET Core MVC + Web API with Overview
PPTX
ASP.NET Core: The best of the new bits
PDF
Moving ASP.NET MVC to ASP.NET Core
PPTX
Moving forward with ASP.NET Core
PPTX
ASP.NET Core Unit Testing
ASP.NET Core MVC + Web API with Overview
The Universal Programming Language: C#
ASP.NET Core MVC + Web API with Overview (Post RC2)
ASP.NET Core MVC + Web API with Overview
ASP.NET Core: The best of the new bits
Moving ASP.NET MVC to ASP.NET Core
Moving forward with ASP.NET Core
ASP.NET Core Unit Testing

What's hot (20)

PPTX
ASP.NET Core 1.0 Overview
PPTX
Getting Started with ASP.net Core 1.0
PPTX
ASP.NET 5 Overview for Apex Systems
PPTX
ASP.NET 5 Overview: Post RTM
PPTX
ASP.NET Brief History
PPTX
Evolution / History of ASP.NET
PPTX
Que hay de nuevo en Visual Studio 2013 y ASP.NET 5.1
PDF
What's New in ASP.NET Core 3
PPTX
Microsoft <3 Linux with ASP.NET Core
PPTX
Introduction to ASPNET Core
PPTX
.Net Core 1.0 vs .NET Framework
PPT
Dependency Injection in Silverlight
PPTX
ASP.NET 5 Overview
PPTX
PPTX
ASP.NET Core
PPTX
Introduction to ASP.NET
PPTX
ASP.NET 5 Overview - Post Build 2015
PPT
TDD with ASP.NET MVC 1.0
PPTX
Deploy a Website in Azure using ARM Templates
PPTX
Fullstack workshop
ASP.NET Core 1.0 Overview
Getting Started with ASP.net Core 1.0
ASP.NET 5 Overview for Apex Systems
ASP.NET 5 Overview: Post RTM
ASP.NET Brief History
Evolution / History of ASP.NET
Que hay de nuevo en Visual Studio 2013 y ASP.NET 5.1
What's New in ASP.NET Core 3
Microsoft <3 Linux with ASP.NET Core
Introduction to ASPNET Core
.Net Core 1.0 vs .NET Framework
Dependency Injection in Silverlight
ASP.NET 5 Overview
ASP.NET Core
Introduction to ASP.NET
ASP.NET 5 Overview - Post Build 2015
TDD with ASP.NET MVC 1.0
Deploy a Website in Azure using ARM Templates
Fullstack workshop
Ad

Viewers also liked (19)

ODP
Embrace HTTP with ASP.NET Web API
PDF
ASP.NET Web API Deep Dive - SSD 2016 London
PPTX
Azure api app autenticação e autorização
PPTX
Azure api apps - Deploy ASP.Net Core
PPTX
Integration Tales: Logic & API apps to the rescue!
PDF
Building Blocks of Angular 2 and ASP.NET Core
PPTX
Web API with ASP.NET MVC by Software development company in india
PPTX
Aspnet core
PPTX
ASP.NET Core Security
PPTX
Building a Web API with ASP.Net Core
PPTX
Swagger - make your API accessible
PPTX
PPTX
Toi uu hoa he thong 30 trieu nguoi dung
PDF
The Ultimate Guide to Mobile API Security
PPTX
Beautiful REST+JSON APIs with Ion
PDF
Build a REST API for your Mobile Apps using Node.js
PDF
Building Beautiful REST APIs with ASP.NET Core
PDF
C# ASP.NET WEB API APPLICATION DEVELOPMENT
PPTX
RESTful API Design Best Practices Using ASP.NET Web API
Embrace HTTP with ASP.NET Web API
ASP.NET Web API Deep Dive - SSD 2016 London
Azure api app autenticação e autorização
Azure api apps - Deploy ASP.Net Core
Integration Tales: Logic & API apps to the rescue!
Building Blocks of Angular 2 and ASP.NET Core
Web API with ASP.NET MVC by Software development company in india
Aspnet core
ASP.NET Core Security
Building a Web API with ASP.Net Core
Swagger - make your API accessible
Toi uu hoa he thong 30 trieu nguoi dung
The Ultimate Guide to Mobile API Security
Beautiful REST+JSON APIs with Ion
Build a REST API for your Mobile Apps using Node.js
Building Beautiful REST APIs with ASP.NET Core
C# ASP.NET WEB API APPLICATION DEVELOPMENT
RESTful API Design Best Practices Using ASP.NET Web API
Ad

Similar to Building HTTP APIs with ASP.NET Core (20)

PPT
ASP.net web api Power Point Presentation
PPTX
ASP.NET Core 1.0
PPT
.NET Core Apps: Design & Development
PPTX
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
PPTX
Introduction Asp.Net Core, MVC, Docker (Linux), Postman and Swagger
PDF
ASP.NET Core 1 for MVC- and WebAPI-Devs
PPTX
Getting started with dotnet core Web APIs
PPTX
ASP.NET Core 2.1: The Future of Web Apps
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
PPTX
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
PDF
Building Web Apis With Aspnet Core Meap Version 11 All 12 Chapters Valerio De...
PPTX
Explore asp.net core 3.0 features
PDF
White Paper : ASP.NET Core AngularJs 2 and Prime
PDF
.NET Core, ASP.NET Core Course, Session 6
PPTX
Introduction-to-ASPNET-Core ASP.NET.pptx
PDF
ASP.NET Web API Interview Questions By Scholarhat
PDF
.NET Core, ASP.NET Core Course, Session 18
DOCX
All the amazing features of asp.net core
PPTX
ASP.NET Core 2.1: The Future of Web Apps
PPTX
ASP.NET Core 2.1: The Future of Web Apps
ASP.net web api Power Point Presentation
ASP.NET Core 1.0
.NET Core Apps: Design & Development
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Introduction Asp.Net Core, MVC, Docker (Linux), Postman and Swagger
ASP.NET Core 1 for MVC- and WebAPI-Devs
Getting started with dotnet core Web APIs
ASP.NET Core 2.1: The Future of Web Apps
Asp.Net Core MVC , Razor page , Entity Framework Core
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
Building Web Apis With Aspnet Core Meap Version 11 All 12 Chapters Valerio De...
Explore asp.net core 3.0 features
White Paper : ASP.NET Core AngularJs 2 and Prime
.NET Core, ASP.NET Core Course, Session 6
Introduction-to-ASPNET-Core ASP.NET.pptx
ASP.NET Web API Interview Questions By Scholarhat
.NET Core, ASP.NET Core Course, Session 18
All the amazing features of asp.net core
ASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core 2.1: The Future of Web Apps

Recently uploaded (20)

PPTX
Lecture 5 Software Requirement Engineering
PDF
Microsoft Office 365 Crack Download Free
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
CNN LeNet5 Architecture: Neural Networks
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
E-Commerce Website Development Companyin india
PPTX
most interesting chapter in the world ppt
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PDF
Visual explanation of Dijkstra's Algorithm using Python
Lecture 5 Software Requirement Engineering
Microsoft Office 365 Crack Download Free
How to Use SharePoint as an ISO-Compliant Document Management System
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
CNN LeNet5 Architecture: Neural Networks
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Full-Stack Developer Courses That Actually Land You Jobs
E-Commerce Website Development Companyin india
most interesting chapter in the world ppt
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Computer Software - Technology and Livelihood Education
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
GSA Content Generator Crack (2025 Latest)
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
Visual explanation of Dijkstra's Algorithm using Python

Building HTTP APIs with ASP.NET Core

  • 1. #td17ch Building HTTP APIs with ASP.NET Core Filip Wojcieszyn Tech Lead CloudServices, Sonova
  • 3. Before ASP.NET Core  HTTP Handlers  ASMX  WCF Web Http | WCF REST Starter Kit  ASP.NET MVC  WCF Web API | ASP.NET Web API
  • 5. Agenda Plan for today  Lightweight HTTP APIs  Security  Documentation  Versioning  Demos https://github.com/filipw/aspnetcore-api-samples
  • 7. What would Martin Fowler do?
  • 11. Lightweight APIs with ASP.NET Core Prefer the IRouter extensions Super lightweight - modeled after other platforms - e.g. Node, Go, Swift Use MVC for more complex backends Don’t unnecessarily rely on the full framework When using MVC, pick and choose pieces you need AddMvcCore() method allows you to add only most basic framework services
  • 12. Super lightweight Whole API in single C# file No MVC Minimal footprint
  • 13. How To Not Set Up an MVC-based API
  • 14. How To Set Up an MVC API
  • 16. HTTP API Security Use JSON Web Tokens (JWT) IdentityServer4 is the most popular OpenID Connect and OAuth 2.0 framework for ASP.NET/ASP.NET Core Tokens can be issued from an embedded server too API could act both as identity and resource server at the same time ASP.NET Core introduces “Authorization Policies” Centralized way to define required claim validations
  • 18. Securing an API (embedded server)
  • 20. HTTP API Documentation Swagger has become a de facto standard Defines swagger.json descriptor file, that allows easy client generation Swashbuckle package for ASP.NET Core Can generate swagger.json for your MVC-based HTTP API ASP.NET Core MVC exposes IApiExplorer service In case you need to manually traverse the endpoints
  • 26. HTTP API Versioning Approaches URI-based GET /v1/contacts GET /contacts?v=1 Header-based GET /contacts Version: 2 Media type-based GET /contacts Accept: application/vnd.contact-v2+json
  • 27. HTTP API Versioning packages Microsoft.AspNetCore.Mvc.Versioning A Microsoft versioning package for ASP.NET Core MVC WebApiContrib.Core.Versioning A community versioning package for ASP.NET Core MVC
  • 28. © 2017 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • 29. © 2017 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.