Chapter 11

ASP.NET Web API

What's In This Chapter?

  • Defining ASP.NET Web API
  • Getting started with Web API
  • Writing an API controller
  • Configuring Web API
  • Comparing Web API and MVC routing
  • Binding parameters
  • Filtering requests
  • Enabling dependency injection
  • Exploring APIs programmatically
  • Tracing the application

The Web API project was born of the passions of the Windows Communication Foundation (WCF) team and its customers, who wanted to have deep integration with HTTP. Previous iterations of web service programming with WCF were mostly an affair of abstractions meant to hide things like transport details. Web API sought to flip the process on its head and strip away most of the layering in WCF and instead give the programmer direct access to all aspects of the HTTP programming model. Developed in the open with frequent preview releases, and shepherded by Henrik Frystyk Nielsen (an architect on the Web API team and one of the original HTTP specification authors), this new framework offered a real alternative for WCF customers who wanted nothing but HTTP, and wanted complete control therein.

In 2011, a reorganization of teams brought the ASP.NET MVC and WCF Web API teams together under Scott Guthrie, who was very interested in merging the two efforts so that customers would be able to easily transition their ASP.NET knowledge into writing web APIs. The teams set out to combine the best ideas of both platforms, and the result — ASP.NET Web API — was born, and shipped alongside ASP.NET ...

Get Professional ASP.NET MVC 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.