Building Rest Services Using
ASP.NET Web API
Brij Bhushan Mishra
http://codewala.net @code_wala https://www.facebook.com/codewala
About Me
• Brij Bhushan Mishra
• 5 times Microsoft MVP - ASP.NET/IIS
• Architect/Consultant/ SME
• Avid Blogger/ Author/ Reviewer
• Speaker at top Conferences including GIDS,
TechEd, C# Corner Conference and many more
• Work closely with various organizations as SME, Content developer, Speaker,
Community Tech Reviewer
• http://codewala.net
• @code_wala
• https://www.facebook.com/codewala
http://codewala.net @code_wala https://www.facebook.com/codewala
What is REST ?
http://codewala.net @code_wala https://www.facebook.com/codewala
Why are we talking about Rest?
• To Understand it, let’s talk about WCF and its working
SOAPSOAPSOAP
http://codewala.net @code_wala https://www.facebook.com/codewala
What is Rest?
• Rest is an Architectural Style
Kalinga Architecture
MughalArchitecture
http://codewala.net @code_wala https://www.facebook.com/codewala
Rest Constraints
• Client Server
• Stateless server
• Cacheable
• Uniform Interface
• Layered System
• Code on Demand
http://codewala.net @code_wala https://www.facebook.com/codewala
Uniform Interface
• Identification of a resource
• Each resource should be identified by an Id (api/books/{id})
• Manipulation of resources through representations
• Same representations should be sent back as are received via API
• Uses the standard HTTP verbs for the operation
http://codewala.net @code_wala https://www.facebook.com/codewala
Why REST?
• Uses HTTP. Less Overhead and lightweight
• Content negotiation
• JSON vs XML
• Any Data from Any Where
http://codewala.net @code_wala https://www.facebook.com/codewala
What is ASP.NET Web API?
ASP.NET Web API is framework that enables to write REST based
services.
http://codewala.net @code_wala https://www.facebook.com/codewala
HTTP Verbs
• GET (Reading the resource)
• POST (Create a resource)
• PUT (Update a resource)
• DELETE (Delete a resource)
• PATCH (Update a resource)
http://codewala.net @code_wala https://www.facebook.com/codewala
Key Characteristics – Defining a Resource
• Collection or single
../api/bookstore/books or /api/bookstore/books/{id}
• Noun (not a verb)
• Navigation (for associated items)
• In Web API, Noun is typically a controller
http://codewala.net @code_wala https://www.facebook.com/codewala
Earlier versions of ASP.NET
http://codewala.net @code_wala https://www.facebook.com/codewala
What we covered today
• What is not REST
• REST Constraints
• What is ASP.NET Web API
• HTTP Verbs
• ASP.NET Core ( MVC = MVC + Web API)
• POSTMAN
• Demo.. Demo..
http://codewala.net @code_wala https://www.facebook.com/codewala
Thank You
http://codewala.net @code_wala https://www.facebook.com/codewala
http://codewala.net
@code_wala
https://www.facebook.com/codewala
brij.mishra@outlook.com
http://bit.ly/1OTSgZ8