Designing Evolvable Web APIs with ASP.NET
by Glenn Block, Pablo Cibraro, Pedro Felix, Howard Dierking, Darrel Miller
Chapter 3. ASP.NET Web API 101
It’s easier to plot a course once you’ve seen the map.
Now that we’ve established the context around why Web APIs are important for modern networked applications, in this chapter we’ll take a first look at ASP.NET Web API. ASP.NET Web API and the new HTTP programming model offer different capabilities for both building and consuming Web APIs. First we’ll explore some of the core Web API goals and the capabilities that support them. We’ll then see how those capabilities are exposed to your code in ASP.NET Web API by looking at its programming model. What better way to examine that than by looking at the code provided by the Visual Studio Web API project template? Finally, we’ll go beyond the default template code and construct our first “Hello World” Web API.
Core Scenarios
Unlike many technologies, ASP.NET Web API has a very well-documented and accessible history (some is recorded on CodePlex). From the beginning, the development team made the decision to be as transparent as possible so that the product could be influenced by the community of experts who would ultimately use it to build real systems. I’ve distilled all that history down to the core goals that ASP.NET was created to address:
- First-class HTTP programming
- Symmetric client and server programming experience
- Flexible support for different formats
- No more “coding with angle brackets”
- Unit testability
- Multiple hosting options
Now, while these are key goals, they by no means represent an ...