SlideShare a Scribd company logo
ASP.NET Web API



Udaiappa Ramachandran
NHDN-Nashua .NET/Cloud Computing UG Lead
Email: udaiappa@gmail.com
Blog: http://cloudycode.wordpress.com
Agenda
 Introduction to Web API
 Web API Routing
 Web API Pipeline
 Dependency Injections and Resolvers
 Model Binding and Media Formats
 Self Hosting
 Deploying Web API into cloud
 References
Introduction to Web API
 Next iteration of WCF REST
 Framework for developing REST Services
 Released part of ASP.NET MVC
 Uses HTTP protocol
 Accessible from wide variety of clients
 Http Methods: GET, POST, PUT, DELETE
 URLs and Methods
Demo: Web API Basics
Web API Routing
   Web API Routing very similar to MVC routing
   Action determined using the HTTP method not the URI path
   Uses “api” in the rout is to avoid collisons with ASP.NET MVC
    routing.
   Adds “Controller” to the controller part of the URL
   Default mapping thru global.asax
   Additional URL parameters are mapped as action parameters
   Explicitly specify the HTTP methods for an action by decorating
    the action method with HttpGet, HttpPut, HttpPost or
    HttpDelete attribute
   Action can be defined thru AcceptVerbs as a method attributes
   Route by Action Name
   Override action name by using ActionName attribute
   Ignore action by NoAction Attribute
Demo: Web API Routing
Filtering
   Uses OData specific keywords
               Directs that related records should be retrieved in the record or collection
    $expand
               being retrieved.
               Specifies an expression or function that must evaluate to ‘true’ for a record to
    $filter
               be returned in the collection.

    $orderby   Determines what values are used to order a collection of records.

    $select    Specifies a sub set of properties to return.

    $skip      Sets the number of records to skip before it retrieves records in a collection.


    $top       Determines the maximum number of records to return.


      Install-Package Microsoft.AspNet.WebApi.OData -Pre
Demo: Web API Filtering
Web API Pipeline
   Both Request and Response Model have pipeline
   Web API has client and server side pipelines
   Both Share the common object HttpMessageHandler
   HttpRequestMessage
     Represents all info about http request such as URL, HTTP Methods and
        Headers
   HttpResponseMessage
     Represents all the info about the Http Response such as StatusCode,
        Success Flag, Original Http Request
   HttpMessageHandler
       Common for both Request and Response
       Most common processing code can be placed here
       Ideal for authentication
       Two Scopes: Global and Per-Route
   Custom Handlers
     Inherit DelegatingHandler
     Custom code to perform any kind of per request functionality
Pipeline Elements
Pipeline Elements
Demo: Web API Pipeline
Demo: Custom Handlers
Dependency Resolution
 Service Oriented Architecture for Decoupling the
  object
 IoC: The concept of allowing something outside of
  system to control it.
 Often done thru DI frameworks
       Unity
       Ninject
       Castle Windsor
       Structure Map
       Spring.net
       Autofac
   Web API provides a hook for us to wire up the
    complex dependency
Demo: Simple Resolver
Demo: Resolve using DI Framework
Data Model and MIME types
   Returning JSON
     Default return format
     Good for mobile apps
     does not require any special code
   Returning XML
     No code change
     Set the request content type as application/xml
   Mime Types:
       return virtually anything that can be sent over the web
       Inherit from BufferedMediaTypeFormatter
       Override key methods
       attach media formatter to configuration
Demo: Data Model
Demo: MIME Types
Hosting
   IIS
    
    
    


   Self Hosting
    
    
    
    
Web api
Demo: Self Hosting
Resource
 http://cloudycode.wordpress.com
 http://www.asp.net/web-api/overview
 http://code.msdn.microsoft.com/ASPNET-Web-API-Self-
  Host-30abca12
 http://msdn.microsoft.com/en-us/library/gg309461.aspx
 http://blogs.msdn.com/b/webdev/archive/2012/08/26/asp-
  net-web-api-and-httpclient-samples.aspx
Q&A
Ad

More Related Content

What's hot (20)

ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
Randy Connolly
 
Web api
Web apiWeb api
Web api
Sudhakar Sharma
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Spray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSpray - Build RESTfull services in scala
Spray - Build RESTfull services in scala
Sandeep Purohit
 
Backbone js
Backbone jsBackbone js
Backbone js
Knoldus Inc.
 
Integration of mule esb with microsoft azure
Integration of mule esb with microsoft azureIntegration of mule esb with microsoft azure
Integration of mule esb with microsoft azure
sivachandra mandalapu
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
baabtra.com - No. 1 supplier of quality freshers
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
Bhumivaghasiya
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails App
Nathalie Steinmetz
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
IndicThreads
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
Antônio Roberto Silva
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400
himajareddys
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
Hitesh Santani
 
Silverlight 2
Silverlight 2Silverlight 2
Silverlight 2
Dave Bost
 
PostgREST Design Philosophy
PostgREST Design PhilosophyPostgREST Design Philosophy
PostgREST Design Philosophy
begriffs
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
Iblesoft
 
Standard control in asp.net
Standard control in asp.netStandard control in asp.net
Standard control in asp.net
baabtra.com - No. 1 supplier of quality freshers
 
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
  Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study  Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
Hima Javvadi
 
Slim Framework
Slim FrameworkSlim Framework
Slim Framework
Pramod Raghav
 
Presentation on asp.net controls
Presentation on asp.net controlsPresentation on asp.net controls
Presentation on asp.net controls
Reshi Unen
 
ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
Randy Connolly
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Spray - Build RESTfull services in scala
Spray - Build RESTfull services in scalaSpray - Build RESTfull services in scala
Spray - Build RESTfull services in scala
Sandeep Purohit
 
Integration of mule esb with microsoft azure
Integration of mule esb with microsoft azureIntegration of mule esb with microsoft azure
Integration of mule esb with microsoft azure
sivachandra mandalapu
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
Bhumivaghasiya
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails App
Nathalie Steinmetz
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
IndicThreads
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
Antônio Roberto Silva
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400
himajareddys
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
Hitesh Santani
 
Silverlight 2
Silverlight 2Silverlight 2
Silverlight 2
Dave Bost
 
PostgREST Design Philosophy
PostgREST Design PhilosophyPostgREST Design Philosophy
PostgREST Design Philosophy
begriffs
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
Iblesoft
 
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
  Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study  Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
Hima Javvadi
 
Presentation on asp.net controls
Presentation on asp.net controlsPresentation on asp.net controls
Presentation on asp.net controls
Reshi Unen
 

Viewers also liked (20)

ZFConf 2010: Proposal Lifecycle
ZFConf 2010: Proposal LifecycleZFConf 2010: Proposal Lifecycle
ZFConf 2010: Proposal Lifecycle
ZFConf Conference
 
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
Dealin Doug
 
Adverts
AdvertsAdverts
Adverts
Katherine Brittain
 
Малобюджетный маркетинг
Малобюджетный маркетингМалобюджетный маркетинг
Малобюджетный маркетинг
evedy
 
Prk acta intercentos_13062012
Prk acta intercentos_13062012Prk acta intercentos_13062012
Prk acta intercentos_13062012
oscargaliza
 
TDR - Predstavljanje poslovanja za 2009. godinu
TDR - Predstavljanje poslovanja za 2009. godinuTDR - Predstavljanje poslovanja za 2009. godinu
TDR - Predstavljanje poslovanja za 2009. godinu
TDR d.o.o Rovinj
 
Proyecto Cactus 1°3vesp
Proyecto Cactus 1°3vespProyecto Cactus 1°3vesp
Proyecto Cactus 1°3vesp
guest32ff1ff
 
LD_March2010_forweb
LD_March2010_forwebLD_March2010_forweb
LD_March2010_forweb
Latino Decisions
 
Yaşamboyu Öğrenme
Yaşamboyu ÖğrenmeYaşamboyu Öğrenme
Yaşamboyu Öğrenme
nazzzy
 
Homophones Lesson
Homophones LessonHomophones Lesson
Homophones Lesson
jgd7971
 
Hyves Cbw Mitex Harry Van Wouter
Hyves Cbw Mitex Harry Van WouterHyves Cbw Mitex Harry Van Wouter
Hyves Cbw Mitex Harry Van Wouter
guest2f17d3
 
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Kalle
 
מכרות הגפרית בבארי
מכרות הגפרית בבארימכרות הגפרית בבארי
מכרות הגפרית בבארי
haimkarel
 
Goldberg Scanpath Clustering And Aggregation
Goldberg Scanpath Clustering And AggregationGoldberg Scanpath Clustering And Aggregation
Goldberg Scanpath Clustering And Aggregation
Kalle
 
TEMA 1B GRAMMAR ADJECTIVES
TEMA 1B GRAMMAR ADJECTIVESTEMA 1B GRAMMAR ADJECTIVES
TEMA 1B GRAMMAR ADJECTIVES
SenoraAmandaWhite
 
Doing Business With Aboriginal People
Doing Business With Aboriginal PeopleDoing Business With Aboriginal People
Doing Business With Aboriginal People
Lee_Ahenakew
 
Movie it process
Movie it processMovie it process
Movie it process
Sana Samad
 
Acta santiago barbanza
Acta santiago barbanzaActa santiago barbanza
Acta santiago barbanza
oscargaliza
 
MobileConf 2013 - Aerogear Android
MobileConf 2013 - Aerogear AndroidMobileConf 2013 - Aerogear Android
MobileConf 2013 - Aerogear Android
Daniel Passos
 
ZFConf 2010: Proposal Lifecycle
ZFConf 2010: Proposal LifecycleZFConf 2010: Proposal Lifecycle
ZFConf 2010: Proposal Lifecycle
ZFConf Conference
 
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
DealinDougCommunity.com - ArapahoeOnline.com; 2009 AAA Aggressive Driving Res...
Dealin Doug
 
Малобюджетный маркетинг
Малобюджетный маркетингМалобюджетный маркетинг
Малобюджетный маркетинг
evedy
 
Prk acta intercentos_13062012
Prk acta intercentos_13062012Prk acta intercentos_13062012
Prk acta intercentos_13062012
oscargaliza
 
TDR - Predstavljanje poslovanja za 2009. godinu
TDR - Predstavljanje poslovanja za 2009. godinuTDR - Predstavljanje poslovanja za 2009. godinu
TDR - Predstavljanje poslovanja za 2009. godinu
TDR d.o.o Rovinj
 
Proyecto Cactus 1°3vesp
Proyecto Cactus 1°3vespProyecto Cactus 1°3vesp
Proyecto Cactus 1°3vesp
guest32ff1ff
 
Yaşamboyu Öğrenme
Yaşamboyu ÖğrenmeYaşamboyu Öğrenme
Yaşamboyu Öğrenme
nazzzy
 
Homophones Lesson
Homophones LessonHomophones Lesson
Homophones Lesson
jgd7971
 
Hyves Cbw Mitex Harry Van Wouter
Hyves Cbw Mitex Harry Van WouterHyves Cbw Mitex Harry Van Wouter
Hyves Cbw Mitex Harry Van Wouter
guest2f17d3
 
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Komogortsev Qualitative And Quantitative Scoring And Evaluation Of The Eye Mo...
Kalle
 
מכרות הגפרית בבארי
מכרות הגפרית בבארימכרות הגפרית בבארי
מכרות הגפרית בבארי
haimkarel
 
Goldberg Scanpath Clustering And Aggregation
Goldberg Scanpath Clustering And AggregationGoldberg Scanpath Clustering And Aggregation
Goldberg Scanpath Clustering And Aggregation
Kalle
 
Doing Business With Aboriginal People
Doing Business With Aboriginal PeopleDoing Business With Aboriginal People
Doing Business With Aboriginal People
Lee_Ahenakew
 
Movie it process
Movie it processMovie it process
Movie it process
Sana Samad
 
Acta santiago barbanza
Acta santiago barbanzaActa santiago barbanza
Acta santiago barbanza
oscargaliza
 
MobileConf 2013 - Aerogear Android
MobileConf 2013 - Aerogear AndroidMobileConf 2013 - Aerogear Android
MobileConf 2013 - Aerogear Android
Daniel Passos
 
Ad

Similar to Web api (20)

Implementation web api
Implementation web apiImplementation web api
Implementation web api
Zeeshan Ahmed Khalil
 
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
Mario Cardinal
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
 
11 asp.net web api
11 asp.net web api11 asp.net web api
11 asp.net web api
Michael Mieles Caballero
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
Ido Flatow
 
Day7
Day7Day7
Day7
madamewoolf
 
Asp.net web api
Asp.net web apiAsp.net web api
Asp.net web api
Binu Bhasuran
 
ASP.NET Core Web API documentation web application
ASP.NET Core Web API documentation web applicationASP.NET Core Web API documentation web application
ASP.NET Core Web API documentation web application
AMARAAHMED7
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Fioriela Bego
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Commit Software Sh.p.k.
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
Revelation Technologies
 
08 ajax
08 ajax08 ajax
08 ajax
Ynon Perek
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
Luis Du Solier
 
Model View Controller-Introduction-Overview.pptx
Model View Controller-Introduction-Overview.pptxModel View Controller-Introduction-Overview.pptx
Model View Controller-Introduction-Overview.pptx
MarioCaday2
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
Peter Gfader
 
Web API with ASP.NET MVC by Software development company in india
Web API with ASP.NET  MVC  by Software development company in indiaWeb API with ASP.NET  MVC  by Software development company in india
Web API with ASP.NET MVC by Software development company in india
iFour Institute - Sustainable Learning
 
Asp.net
Asp.netAsp.net
Asp.net
Naveen Sihag
 
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
Mario Cardinal
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
 
ASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP FundamentalsASP.NET Web API and HTTP Fundamentals
ASP.NET Web API and HTTP Fundamentals
Ido Flatow
 
ASP.NET Core Web API documentation web application
ASP.NET Core Web API documentation web applicationASP.NET Core Web API documentation web application
ASP.NET Core Web API documentation web application
AMARAAHMED7
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Fioriela Bego
 
ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!ASP.NET - Building Web Application..in the right way!
ASP.NET - Building Web Application..in the right way!
Commit Software Sh.p.k.
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
4 - Silverlight y SharePoint, por Rodrigo Diaz y Mauricio Angulo
Luis Du Solier
 
Model View Controller-Introduction-Overview.pptx
Model View Controller-Introduction-Overview.pptxModel View Controller-Introduction-Overview.pptx
Model View Controller-Introduction-Overview.pptx
MarioCaday2
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
Peter Gfader
 
Ad

Recently uploaded (20)

Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 

Web api

  • 1. ASP.NET Web API Udaiappa Ramachandran NHDN-Nashua .NET/Cloud Computing UG Lead Email: [email protected] Blog: http://cloudycode.wordpress.com
  • 2. Agenda  Introduction to Web API  Web API Routing  Web API Pipeline  Dependency Injections and Resolvers  Model Binding and Media Formats  Self Hosting  Deploying Web API into cloud  References
  • 3. Introduction to Web API  Next iteration of WCF REST  Framework for developing REST Services  Released part of ASP.NET MVC  Uses HTTP protocol  Accessible from wide variety of clients  Http Methods: GET, POST, PUT, DELETE  URLs and Methods
  • 4. Demo: Web API Basics
  • 5. Web API Routing  Web API Routing very similar to MVC routing  Action determined using the HTTP method not the URI path  Uses “api” in the rout is to avoid collisons with ASP.NET MVC routing.  Adds “Controller” to the controller part of the URL  Default mapping thru global.asax  Additional URL parameters are mapped as action parameters  Explicitly specify the HTTP methods for an action by decorating the action method with HttpGet, HttpPut, HttpPost or HttpDelete attribute  Action can be defined thru AcceptVerbs as a method attributes  Route by Action Name  Override action name by using ActionName attribute  Ignore action by NoAction Attribute
  • 6. Demo: Web API Routing
  • 7. Filtering  Uses OData specific keywords Directs that related records should be retrieved in the record or collection $expand being retrieved. Specifies an expression or function that must evaluate to ‘true’ for a record to $filter be returned in the collection. $orderby Determines what values are used to order a collection of records. $select Specifies a sub set of properties to return. $skip Sets the number of records to skip before it retrieves records in a collection. $top Determines the maximum number of records to return. Install-Package Microsoft.AspNet.WebApi.OData -Pre
  • 8. Demo: Web API Filtering
  • 9. Web API Pipeline  Both Request and Response Model have pipeline  Web API has client and server side pipelines  Both Share the common object HttpMessageHandler  HttpRequestMessage  Represents all info about http request such as URL, HTTP Methods and Headers  HttpResponseMessage  Represents all the info about the Http Response such as StatusCode, Success Flag, Original Http Request  HttpMessageHandler  Common for both Request and Response  Most common processing code can be placed here  Ideal for authentication  Two Scopes: Global and Per-Route  Custom Handlers  Inherit DelegatingHandler  Custom code to perform any kind of per request functionality
  • 12. Demo: Web API Pipeline Demo: Custom Handlers
  • 13. Dependency Resolution  Service Oriented Architecture for Decoupling the object  IoC: The concept of allowing something outside of system to control it.  Often done thru DI frameworks  Unity  Ninject  Castle Windsor  Structure Map  Spring.net  Autofac  Web API provides a hook for us to wire up the complex dependency
  • 14. Demo: Simple Resolver Demo: Resolve using DI Framework
  • 15. Data Model and MIME types  Returning JSON  Default return format  Good for mobile apps  does not require any special code  Returning XML  No code change  Set the request content type as application/xml  Mime Types:  return virtually anything that can be sent over the web  Inherit from BufferedMediaTypeFormatter  Override key methods  attach media formatter to configuration
  • 17. Hosting  IIS     Self Hosting    
  • 20. Resource  http://cloudycode.wordpress.com  http://www.asp.net/web-api/overview  http://code.msdn.microsoft.com/ASPNET-Web-API-Self- Host-30abca12  http://msdn.microsoft.com/en-us/library/gg309461.aspx  http://blogs.msdn.com/b/webdev/archive/2012/08/26/asp- net-web-api-and-httpclient-samples.aspx
  • 21. Q&A