Developer code samples

Contributions
Favorites
Sort by:

Many popular Web APIs such as the twitter API use some form of
OAuth for authentication. HttpClient does not have baked in support for OAuth but using the HttpClient extensibility model you can add OAuth as part of the HttpMessageHandler pipeline. This sample shows you how.
Json.Net is a popular framework for working with JSON. In particular, it has a bunch of features that are not supported by the DataContractJsonSerializer such as being much more flexible in what kind of types it can serialize and exactly how they should be serialized.
HttpClient is a modern HTTP client for .NET. It provides a flexible and extensible API for accessing all things exposed through HTTP. HttpClient has been available for a while as part of
WCF Web API preview 6 but is now shipping as part of
ASP.NET Web API and in .NET 4.5.
Downloading content to a local file is a common thing to do. The current version of HttpClient doesn’t yet provide out of the box support for saving content to a file but this sample shows how to extend HttpClient with new ways of reading content retrieved using HttpClient.
MongoDB is a popular
NoSQL database that makes it a great backend for Web APIs which lend themselves towards a
document store. Here we show how you can use
MongoDB with
ASP.NET Web API to build an ApiController with support for HTTP GET, PUT, POST, and DELETE.
No favorites have been added.