Your SlideShare is downloading. ×
ASP.NET MVC Web API
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

ASP.NET MVC Web API

1,420

Published on

Brownbag presentation on ASP.NET Web API for MPS Partners and clients, September 2012.

Brownbag presentation on ASP.NET Web API for MPS Partners and clients, September 2012.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,420
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Bolt-on APIs, MVC-conventions throughout your front end
  • Transcript

    • 1. Andy Badera, Microsoft Evangelist Solution & Platform Evangelism MPS Partners
    • 2.  What is it? What can it do for me? How is it different from MVC?
    • 3.  Simplicity MVC-like routing/naming conventions Rapid prototyping/iterative dev Media type formatters Easy (de)serialization Easy PATCH support
    • 4.  Light on OOTB security (can be added) Potential for confusion across HTTP routes, naming conventions and declarations Single primitive value passable in body Cannot pass naked primitives as JSON
    • 5.  Web API version of MVC Routes Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: “api/{controller}/{id}”, defaults: new { id = RouteParameter.Optional });
    • 6.  GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS “All”, “By*” GetEnabledUsers, [verb]EnabledUsers: config.Routes.MapHttpRoute( name: "EnabledUsersRoute", routeTemplate: “Users/{someguid}/enabled”); http://host/Users/{someguid}/enabled
    • 7.  Simple types (primitives, DateTime) default from URI Complex types from body Simple types can be passed in body (x-www- form-urlencoded only) if method parameter is marked with [FromBody]
    • 8.  Accept header ◦ application/xml ◦ application/json Custom formatters
    • 9.  JSON.NET (Newtonsoft) shipped as default in RTW DataContractJsonSerializer Can be swapped/substituted Per-type XML Serializers (backwards compatibility)
    • 10.  VS2010: JSONtoCSharp http://json2csharp.com/ VS2012: Web Essentials, Paste Special JSON Formatter & Validator http://jsonformatter.curiousconcept.com/
    • 11.  New-ish HTTP verb Partial record modification of existing resource (vs POST full record modification of existing resource) JSON handling is conducive to easy deserialization of partial objects

    ×