Tuesday, October 1, 2013

Fully supported and extensible framework for building HTTP based endpoints

Available via NuGet

includes a new HTTP client, runs on .NET 4


  1. Server-side web API request-response expressed in json or xml
  2. Build Restful URL's'
  3. Access via standard HTTP methods
  4. HTTP clients browsers and mobile devices
  5. Expose services and data
  6. HTTP is simple, flexible and ubiquitous

Download and install Web Api via NuGet

Create Controller with Get method

Configure Route in Global.asax

Invoking Controller without controller suffix prepended in url

New Web API project

Global.asax, Application start, executes on start of application, register web api config

Configuration of default route

Default controller with get verb returning an ienumerable of string

View in browser api/values invokes the default get method and returns array of string with value1 and value2

Add Web API to an existing ASP.NET MVC project with Nuget

In Global.asax new line web api config register brought in

Enables to expose iqueryable endpoint benefit expose odata feeds

Build the first Api Controller, an empty api controller

Create first get method

Render json in the user agent

View json in the browser

Default Success Warning Important Info Inverse
B S W I ? O