building web apis in windows azure
DESCRIPTION
Building Web APIs in Windows Azure. Name Title Microsoft Corporation. Agenda . Why all the hype for Web APIs? Building Web APIs for browser/JSON clients Building Web APIs for native/non-browser clients. The game has changed. - PowerPoint PPT PresentationTRANSCRIPT
Building Web APIs in Windows Azure
Building Web APIs in Windows AzureNameTitleMicrosoft Corporation1
Agenda Why all the hype for Web APIs?Building Web APIs for browser/JSON clientsBuilding Web APIs for native/non-browser clients2
The game has changed3
Today if you want to reach your user, you have to reach their device
4
In this talk youll learn how5
WCF Web APIs in Windows AzureReach any device6
Building a Web API for browser/JSON clients7
Building a Read Only Web APIWhy?Allow browser clients to easily retrieve information from your system8
Building a read only Web APIdemo9
Building a Read Only Web APIWebApi and WebApi.Enhancements nugetsWebGet attribute defines the URI templateReturn JsonValue/List, you dont have to craft a CLR type10
Manipulating HTTP ResponsesWhy?Enable client/intermediary cachingHandle status codesAdd links via link headers11
Manipulating HTTP responsesdemo12
Manipulating HTTP ResponsesReturn HttpResponseMessage to modify response headersThrow HttpResponseException to stop processing immediately and return a response, such as a status 40413
Making an API UpdatableWhy?Allow clients to modify the state of the server14
Making an API updatabledemo15
Making an API UpdatableUse WebInvoke for specifying HTTP methodUse HttpResponseMessage to access headers like location headerUse WebApi.Enhancements to support FormUrlEncodingOn IIS, make sure to configure to allow PUT/DELETE
16
Supporting HTML File UploadWhy?Allow clients to send files from a browser17
HTML file uploadUsing HttpContent to work with the body of the requestdemo18
Support HTML File UploadIsMimeMultipartContent checks if multipartMultipartFormDataStreamProvider parses the streamsBodyPartFileNames returns the list of files sent in the stream19
Configuring Your Web APIWhy?Change common settings like MaxRecievedMessageSizeEnable web api test clientWire up an IoC containerEnable securityConfigure handlers and formattersAdding custom error handlers20
Configuring your Web APIdemo21
Configuring Your Web APIHttpConfiguration provides a code based configuration mechanismNew it up directly or derive from it Pass config to HttpServiceHostFactory/HttpServiceHost22
Building a Web API for any client23
Configuring Media Type Formatters Why?Tweak our Xml/Json formattersOData clientsOther native/non-browser clients Custom media types24
Configuring media type formattersODATA, JSON.NET, HALdemo25
Configuring Media Type FormattersModify HttpConfiguration.Formatters to add/remove formattersFormatters.XmlFormatter/Formatters.JsonFormatter to tweak existing formatterODataMediaTypeFormatter Derive from MediaTypeFormatter to create your own custom26
Whats on our road map?27
What Else is on Our Road MapOAuth 2.0/Basic over HTTPsRIA Services integrationDeeper integration with ASP.NET MVC/richer routing supportOData linkingDeeper Azure integration:ServiceBus, Caching
28
Where can you get it?29
Find Us on NugetNuget PackagesWebApiWebApi.ODataJsonValueHttpClientWebApi.Enhancements
30
And on Codeplex
31
What We LearnedWhy Web APIs are importantHow to author Web APIs for multiple clientsHow configure a Web APIEnabling HTML file uploadEnabling OData and custom formatsUsing the Web API test client32
wcf.codeplex.comblogs.msdn.com/gblockcodebetter.com/howardTOPOL-796T: ASP.NET 4.5 loves HTML5, CSS3 & JavaScriptTOOL-797T: Its not a great phone app without ASP.NET services and push notificationsTOOL-800T: Building data-driven HTML5 apps with WCF RIA ServicesTOOL-803T: Enabling Mobile apps with ASP.NET MVCSAC-807T: Building real-time web apps with WebSockets using IIS, ASP.NET and WCFRelated sessionsDocumentation & articlesFor More Information33
ResourcesFeedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback 34
2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.35