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

ASP.NET MVC Web API

on

  • 1,562 views

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.

Statistics

Views

Total Views
1,562
Views on SlideShare
1,559
Embed Views
3

Actions

Likes
0
Downloads
15
Comments
0

2 Embeds 3

http://www.linkedin.com 2
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Bolt-on APIs, MVC-conventions throughout your front end

ASP.NET MVC Web API ASP.NET MVC Web API Presentation Transcript

  • Andy Badera, Microsoft Evangelist Solution & Platform Evangelism MPS Partners
  •  What is it? What can it do for me? How is it different from MVC?
  •  Simplicity MVC-like routing/naming conventions Rapid prototyping/iterative dev Media type formatters Easy (de)serialization Easy PATCH support
  •  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
  •  Web API version of MVC Routes Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: “api/{controller}/{id}”, defaults: new { id = RouteParameter.Optional });
  •  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
  •  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]
  •  Accept header ◦ application/xml ◦ application/json Custom formatters
  •  JSON.NET (Newtonsoft) shipped as default in RTW DataContractJsonSerializer Can be swapped/substituted Per-type XML Serializers (backwards compatibility)
  •  VS2010: JSONtoCSharp http://json2csharp.com/ VS2012: Web Essentials, Paste Special JSON Formatter & Validator http://jsonformatter.curiousconcept.com/
  •  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