Today we announced the release of Visual Studio 2012 and .NET 4.5 which of course includes ASP.NET Web API. There is a ton of new features in VS 2012 and I highly recommend checking out the videos by Scott Hanselman demonstrating a broad set of features of VS 2012 and .NET 4.5.
In addition to shipping as part of Visual Studio 2012 you can also download Web API for Visual Studio 2010 as a standalone installer and as always, you can find us in our Open Source home on codeplex where you can see the source, contribute pull requests, and log issues. The official release (RTM) corresponds to this branch in the source repository.
Further, you can find a bunch of ASP.NET Web API and HttpClient samples demonstrating many of the features. The samples also live on codeplex so that you can download them and work with them. Here you will find samples for both VS 2010 and VS 2012 illustrating a variety of features of both ASP.NET Web API and HttpClient.
In addition to all this we also today release four preview NuGet packages which build on the ASP.NET Web API RTM bits but provide new features. The previews are explicitly marked as alpha releases as they are early builds. The previews are continuously updated and you can get the latest builds from our nightly NuGet feed, please see Using Nightly ASP.NET Web Stack NuGet Packages for details.
The Microsoft ASP.NET Web API OData package contains everything you need to create OData endpoints using ASP.NET Web API and to support OData query syntax for your Web APIs. It supersedes the early query support in ASP.NET Web API Beta with much better support for both querying as well as sending and receiving OData formatted payloads. For a detailed description of the OData support, please see the blog OData support in ASP.NET Web API.
There are two samples demonstrating how to use the OData package that both available in source as part of ASP.NET Web API and HttpClient samples:
This sample shows how to introduce OData queries in ASP.NET Web API using either the [Queryable] attribute or by using the ODataQueryOptions action parameter which allows the action to manually inspect the query before it is being executed. The sample illustrates queries using $orderby, $skip, $top, and $filter as well as any() and all().
This sample illustrates how to create an OData service consisting of four entities and three ApiControllers. The controllers provide various levels of functionality in terms of the OData functionality they expose. In addition the OData service exposes a $metadata document which allows the data to the consumed by WCF Data Service clients and other clients that accept the $metadata format.
The data model contains three entities (Supplier, ProductFamily, and Product) connected in various ways and uses three sample controllers demonstrating various levels of exposing OData ranging from Query to Update and Delete.
Furthermore, the ODataService exposes a Service Document (aka. $metadata document) that lists all the top-level entities so clients can discover them. This enables OData clients to discover and consume OData Services exposed through ASP.NET Web API.
The Microsoft ASP.NET Web API Help Page package automatically generates help page content for Web APIs on your site. Visitors to your help page can use this content to learn how to call your web APIs. Everything generated by the help page is fully customizable using ASP.NET MVC and Razor. ASP.NET Web API Help Page is a great addition to any ASP.NET Web API project.
For more information and a nice video walkthrough, please see the blog Introducing the ASP.NET Web API Help Page (Preview)
The Microsoft ASP.NET Web API Tracing package allows the ASP.NET Web API framework to trace to System.Diagnostics.Trace so that you can now get trace messages from the entire ASP.NET Web API message pipeline from when a request starts being processed to a response is generated.
When installing this package in your project, it adds the following source file was added to your project:
To enable tracing in your application, simply add the following line of code to your startup code (for example in WebApiConfig.cs or Global.asax.cs in an MVC 4 project):
where 'config' is the HttpConfiguration instance for your application. When running your application you can now see trace output written toSystem.Diagnostics.Trace.
For more information about tracing, please see the blog ASP.NET Web API Tracing (Preview).
System.Net.Http.Formatting for Windows 8
The Microsoft ASP.NET Web API Client Libraries package adds support for formatting and content negotiation to System.Net.Http when writing Windows Store Apps. It includes support for JSON, XML, form URL encoded data, as well as MIME multipart. This package requires Visual Studio 2012 and Windows 8.
We are looking forward to your feedback – both on RTM as well as these previews.