Contents
Chapter 1: Building a Basic Web API
1.1 Choosing ASP.NET Web API or WCF
1.2 Exposing an In-Memory List over HTTP
1.3 Choosing Configuration over Convention
1.4 Playing by the Rules of HTTP
1.4.2 Creating a Resource with a Server-Generated Identifier
1.4.3 Creating a Resource with a Client-Supplied Identifier
1.4.6 Partially Updating (Patching) a Resource
Chapter 2: Debugging and Tracing
2.1 Using Fiddler for Web Debugging
2.2 Capturing Console App Traffic through Fiddler
2.3 Capturing HTTPS Traffic in Fiddler
2.4 Composing and Submitting Requests in Fiddler
2.5 Using F12 Developer Tools in Internet Explorer
2.6 Using Developer Tools in Chrome
2.7 Enabling ASP.NET Web API Tracing
2.8 Creating a Custom Trace Writer
2.11 Tracing Request and Response Messages
Chapter 3: Media-Type Formatting CLR Objects
3.1 Listing the Out-of-Box Media Formatters
3.3 Requesting a Content Type through the Query String
3.4 Requesting a Content Type through the Header
3.5 Implementing a Custom Media Type Mapping
3.6 Overriding Conneg and Returning JSON
3.8 Creating a Custom Media Formatter
3.9 Extending an Out-of-Box Media Formatter
3.10 Controlling Which Members Are Serialized
3.11 Controlling How Members Are Serialized
3.11.1 Controlling Member Names
3.12 Returning Only a Subset of Members
Chapter 4: Customizing Response
4.1 Negotiating Character Encoding
4.2 Supporting DBCS Character Encoding (Shift JIS)
4.3 Negotiating Content Encoding (Compression)
4.4.1 Internationalizing the Messages to the User
4.4.2 Internationalizing the Decimal Separators of Numbers
4.4.3 Internationalizing the Dates
Chapter 5: Binding an HTTP Request into CLR Objects
5.1 Reading the Raw HTTP Request
5.2 Reading the HTTP Request into a CLR Type
5.3 Binding the HTTP Request to Simple Types
5.4 Binding the HTTP Request to Complex Types
5.5 Binding the HTTP Request to a Collection
5.6.1 Binding to FormDataCollection
5.6.3 Binding to a Simple Type
5.9 Creating a Custom Value Provider
5.10 Creating a Custom Model Binder
5.11 Creating a Custom Parameter Binder
5.12 Creating a Custom Media Formatter
Chapter 6: Validating Requests
6.1 Validation Using Data Annotations
6.2 Handling Validation Errors
6.3 Extending an Out-of-the-Box Validation Attribute
6.4 Creating Your Own Validation Attribute
6.5 Implementing the IValidatableObject Interface
Chapter 7: Managing Controller Dependencies
7.1 Taking Dependency on the Entity Framework
7.2 Inverting Entity Framework Dependencies
7.3 Using the Repository Pattern
7.4 Using the Generic Repository Pattern
7.5 Mapping a Domain to Data Transfer Object (DTO)
7.6 Injecting Dependencies Using StructureMap
7.7 Unit-Testing the Controller
Chapter 8: Extending the Pipeline
8.1 Creating a Message Handler
8.2 Creating an Exception Filter
8.3 Creating an Action Filter to Handle Concurrency
8.4 Creating a Controller Selector for Versioning
Chapter 9: Hosting ASP.NET Web API
9.1 Web Hosting ASP.NET Web API
9.2 Self-Hosting ASP.NET Web API
9.3 In-Memory Hosting ASP.NET Web API
Chapter 10: Securing ASP.NET Web API
10.1 Implementing Direct Authentication
10.2 Implementing Brokered Authentication
Chapter 11: Consuming ASP.NET Web API
11.1 Calling a Web API from a Console Application
11.2 Calling a Web API from a WPF Application
11.3 Calling a Web API from JavaScript
Chapter 12: Building a Performant Web API
12.1 Creating Asynchronous Action Methods
12.2 Pushing Real-time Updates to the Client