SlideShare a Scribd company logo
06 | HTTP Services with Web API 
Bruno Terkaly | Technical Evangelist 
Bret Stateham | Technical Evangelist
Module Overview 
• Service Frameworks Review 
• Creating Web API Services 
• Consuming Web API Services 
• Configuring Routes
Service Frameworks Review
Web Services “Through the Years” 
WCF “Brand” 
• WCF “Classic” 
• WCF Data Services 
• WCF RIA Services 
• WCF Web HTTP 
ASP.NET “Brand” 
• ASP.NET Web Services (ASMX) 
• ASP.NET MVC 
• ASP.NET Web API 
• ASP.NET Web API Odata 
• ASP.NET SignalR 
Blatantly stolen from Daniel Roth’s Tech Ed 2013 “Serious Web Services” Session
SOAP vs. REST 
? 
SOAP REST 
• XML Based Messaging 
• Contains Envelopes, Headers, Body 
• Can be sent over any transport 
• WS* added Security, Reliability, Transactions… 
• WCF is a full SOAP/WS* Framework 
• REpresenation State Transfer 
• Matches Architecture of the web 
• REST Service =<usually>= HTTP Service 
• Leverage HTTP methods (GET,POST,DELETE…) 
• Web API is a way to create an HTTP Service
SOAP Client Support 
Proxy Generator No Simple Proxy Generator
REST Client Support 
HTTP Client
Creating Web API Services
ASP.NET Web API 
• Open source: aspnetwebstack.codeplex.com 
– Nightly builds 
• Web API 2 shipped with VS2013 
• Learn more at asp.net/web-api
Creating a Web API 
• Derive from ApiController 
• Implement Actions 
• Actions map to HTTP methods (GET, POST, PUT, DELETE) 
– Either prefix your action method name with HTTP verb: GetCustomer 
– Use Attributes if you want to name your action methods differently 
• [HttpGet] 
• [HttpPost] 
• [HttpPut] 
• [HttpDelete]
DEMO 
Creating Web API Services
Consuming Web API Services
Consuming HTTP Clients 
• Build your client side models (optional) 
• Use the HttpClient to call REST Service URLs 
– Set headers 
– Query String 
– Body (for POST and PUT) 
• Use a JSON Serializer / Deserializer (Like Json.NET) 
– Map objects to JSON (Serializer) 
– Map JSON to Objects (Deserializer)
DEMO 
Consuming Web API Services
Configuring Web API Services
Configuring Routes 
• Routes map URI templates to ApiControllers 
– Default Route: api/{controller}/id 
– {controller} + “Controller” = ApiContoller type name 
– HTTP Verb (Get, Post, Put, Delete) is used to determine action 
– {id} is passed as an argument to the action method 
• For example: 
– An HTTP GET to http://mysite.com/api/customer/1 
– {controller} = “customer” => CustomerController class 
– HTTP GET implies method that starts with the word “Get” 
– {id} value looks for a Get(object id) method and passes {id} as arg
DEMO 
Configuring Routes
©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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

What's hot (20)

PPTX
MSDN Sessions 032817 - Azure Functions
Marc Obaldo
 
PPTX
EXPERTALKS: Feb 2013 - Rise of the Single Page Application
EXPERTALKS
 
PPTX
SoCal Code Camp 2011 - ASP.NET MVC 4
Jon Galloway
 
PPTX
Clean up this mess - API Gateway & Service Discovery in .NET
Marcin Tyborowski
 
PPTX
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
Sencha
 
PDF
AWS Community Day - Piyali Kamra - Conversational AI Ecosystem on AWS
AWS Chicago
 
PPTX
GIB2021 - Dan Probert - BizTalk Migrator Deep Dive
probertdaniel
 
PPTX
Angular 2 with typescript
Tayseer_Emam
 
PDF
Tips and Tricks for Building Visual Studio Workflows
Malin De Silva
 
PDF
Understanding SharePoint Framework Extensions
BIWUG
 
PDF
A Simpler Web App Architecture (jDays 2016)
Gustaf Nilsson Kotte
 
PPTX
Angular js firebase-preso
Avinash Kondagunta
 
PPT
Using RESTFUL APIs in ANGULARJS
Mindfire Solutions
 
PPTX
Building Office 365 solutions with React
Waldek Mastykarz
 
PPTX
SPSBE18: New era of customizing site provisioning
Olli Jääskeläinen
 
PPTX
Featfures of asp.net
DivyaDev9
 
PPTX
Angular4 kickstart
Foyzul Karim
 
PPTX
Clean up this mess - API Gateway & Service Discovery in .NET
Marcin Tyborowski
 
PDF
Blazor certification training - Dot Net Tricks
Gaurav Singh
 
PDF
Angularjs & REST
Corley S.r.l.
 
MSDN Sessions 032817 - Azure Functions
Marc Obaldo
 
EXPERTALKS: Feb 2013 - Rise of the Single Page Application
EXPERTALKS
 
SoCal Code Camp 2011 - ASP.NET MVC 4
Jon Galloway
 
Clean up this mess - API Gateway & Service Discovery in .NET
Marcin Tyborowski
 
SenchaCon 2016: Enterprise Applications, Role Based Access Controls (RBAC) an...
Sencha
 
AWS Community Day - Piyali Kamra - Conversational AI Ecosystem on AWS
AWS Chicago
 
GIB2021 - Dan Probert - BizTalk Migrator Deep Dive
probertdaniel
 
Angular 2 with typescript
Tayseer_Emam
 
Tips and Tricks for Building Visual Studio Workflows
Malin De Silva
 
Understanding SharePoint Framework Extensions
BIWUG
 
A Simpler Web App Architecture (jDays 2016)
Gustaf Nilsson Kotte
 
Angular js firebase-preso
Avinash Kondagunta
 
Using RESTFUL APIs in ANGULARJS
Mindfire Solutions
 
Building Office 365 solutions with React
Waldek Mastykarz
 
SPSBE18: New era of customizing site provisioning
Olli Jääskeläinen
 
Featfures of asp.net
DivyaDev9
 
Angular4 kickstart
Foyzul Karim
 
Clean up this mess - API Gateway & Service Discovery in .NET
Marcin Tyborowski
 
Blazor certification training - Dot Net Tricks
Gaurav Singh
 
Angularjs & REST
Corley S.r.l.
 

Viewers also liked (6)

PPTX
05 entity framework
Bat Programmer
 
PPTX
03 data storage
Bat Programmer
 
PPTX
07 advanced topics
Bat Programmer
 
PPTX
04 data accesstechnologies
Bat Programmer
 
PPTX
02 hosting servicesinwindowsazure
Bat Programmer
 
PPTX
1. WCF Services - Exam 70-487
Bat Programmer
 
05 entity framework
Bat Programmer
 
03 data storage
Bat Programmer
 
07 advanced topics
Bat Programmer
 
04 data accesstechnologies
Bat Programmer
 
02 hosting servicesinwindowsazure
Bat Programmer
 
1. WCF Services - Exam 70-487
Bat Programmer
 
Ad

Similar to 06 web api (20)

PPTX
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
keshabregmi1
 
PPTX
ASP.NET Mvc 4 web api
Tiago Knoch
 
PPTX
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
keshabregmi1
 
PPTX
Web API or WCF - An Architectural Comparison
Adnan Masood
 
PPTX
Web api
udaiappa
 
PPTX
Rest WebAPI with OData
Mahek Merchant
 
PPTX
REST and ASP.NET Web API (Tunisia)
Jef Claes
 
PDF
Unleash the power of HTTP with ASP.NET Web API
Filip W
 
PPTX
C# web api
Simplilearn
 
PPTX
Website RESTful APIs
Tyrone Allen
 
PPTX
Implementation web api
Zeeshan Ahmed Khalil
 
PDF
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
 
PDF
API Workshop Amsterdam presented by API Architect Ronnie Mitra
CA API Management
 
PDF
ASP NET Web API 2 Building a REST Service from Start to Finish 2nd Edition Ja...
prienmance8p
 
PPTX
Will be an introduction to
Sayed Ahmed
 
PPTX
Asp.net web api
Binu Bhasuran
 
PPTX
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Codecamp Romania
 
PDF
Complete guidance book of Asp.Net Web API
Shabista Imam
 
PDF
Designing Evolvable Web Apis With Aspnet 1st Edition Glenn Block
zisanashham6
 
PDF
API Introduction - API Management Workshop Munich from Ronnie Mitra
CA API Management
 
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
keshabregmi1
 
ASP.NET Mvc 4 web api
Tiago Knoch
 
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
keshabregmi1
 
Web API or WCF - An Architectural Comparison
Adnan Masood
 
Web api
udaiappa
 
Rest WebAPI with OData
Mahek Merchant
 
REST and ASP.NET Web API (Tunisia)
Jef Claes
 
Unleash the power of HTTP with ASP.NET Web API
Filip W
 
C# web api
Simplilearn
 
Website RESTful APIs
Tyrone Allen
 
Implementation web api
Zeeshan Ahmed Khalil
 
ASP.NET Web API Interview Questions By Scholarhat
Scholarhat
 
API Workshop Amsterdam presented by API Architect Ronnie Mitra
CA API Management
 
ASP NET Web API 2 Building a REST Service from Start to Finish 2nd Edition Ja...
prienmance8p
 
Will be an introduction to
Sayed Ahmed
 
Asp.net web api
Binu Bhasuran
 
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
Codecamp Romania
 
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Designing Evolvable Web Apis With Aspnet 1st Edition Glenn Block
zisanashham6
 
API Introduction - API Management Workshop Munich from Ronnie Mitra
CA API Management
 
Ad

06 web api

  • 1. 06 | HTTP Services with Web API Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist
  • 2. Module Overview • Service Frameworks Review • Creating Web API Services • Consuming Web API Services • Configuring Routes
  • 4. Web Services “Through the Years” WCF “Brand” • WCF “Classic” • WCF Data Services • WCF RIA Services • WCF Web HTTP ASP.NET “Brand” • ASP.NET Web Services (ASMX) • ASP.NET MVC • ASP.NET Web API • ASP.NET Web API Odata • ASP.NET SignalR Blatantly stolen from Daniel Roth’s Tech Ed 2013 “Serious Web Services” Session
  • 5. SOAP vs. REST ? SOAP REST • XML Based Messaging • Contains Envelopes, Headers, Body • Can be sent over any transport • WS* added Security, Reliability, Transactions… • WCF is a full SOAP/WS* Framework • REpresenation State Transfer • Matches Architecture of the web • REST Service =<usually>= HTTP Service • Leverage HTTP methods (GET,POST,DELETE…) • Web API is a way to create an HTTP Service
  • 6. SOAP Client Support Proxy Generator No Simple Proxy Generator
  • 7. REST Client Support HTTP Client
  • 8. Creating Web API Services
  • 9. ASP.NET Web API • Open source: aspnetwebstack.codeplex.com – Nightly builds • Web API 2 shipped with VS2013 • Learn more at asp.net/web-api
  • 10. Creating a Web API • Derive from ApiController • Implement Actions • Actions map to HTTP methods (GET, POST, PUT, DELETE) – Either prefix your action method name with HTTP verb: GetCustomer – Use Attributes if you want to name your action methods differently • [HttpGet] • [HttpPost] • [HttpPut] • [HttpDelete]
  • 11. DEMO Creating Web API Services
  • 12. Consuming Web API Services
  • 13. Consuming HTTP Clients • Build your client side models (optional) • Use the HttpClient to call REST Service URLs – Set headers – Query String – Body (for POST and PUT) • Use a JSON Serializer / Deserializer (Like Json.NET) – Map objects to JSON (Serializer) – Map JSON to Objects (Deserializer)
  • 14. DEMO Consuming Web API Services
  • 16. Configuring Routes • Routes map URI templates to ApiControllers – Default Route: api/{controller}/id – {controller} + “Controller” = ApiContoller type name – HTTP Verb (Get, Post, Put, Delete) is used to determine action – {id} is passed as an argument to the action method • For example: – An HTTP GET to http://mysite.com/api/customer/1 – {controller} = “customer” => CustomerController class – HTTP GET implies method that starts with the word “Get” – {id} value looks for a Get(object id) method and passes {id} as arg
  • 18. ©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics 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.

Editor's Notes