Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building rest services using aspnetwebapi

4,677 views

Published on

Presented in C# Corner South India Meet on 31st Jan 16

Published in: Software
  • Be the first to comment

Building rest services using aspnetwebapi

  1. 1. Building Rest Services Using ASP.NET Web API Brij Bhushan Mishra http://codewala.net @code_wala https://www.facebook.com/codewala
  2. 2. 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
  3. 3. What is REST ? http://codewala.net @code_wala https://www.facebook.com/codewala
  4. 4. Everybody needs REST? Representational State TransferRepresentational State Transfer http://codewala.net @code_wala https://www.facebook.com/codewala
  5. 5. 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
  6. 6. What is Rest? • Rest is an Architectural Style Kalinga Architecture MughalArchitecture http://codewala.net @code_wala https://www.facebook.com/codewala
  7. 7. Rest Constraints • Client Server • Stateless server • Cacheable • Uniform Interface • Layered System • Code on Demand http://codewala.net @code_wala https://www.facebook.com/codewala
  8. 8. Client Server Request Response http://codewala.net @code_wala https://www.facebook.com/codewala
  9. 9. Stateless Sever Request Response Request Response No State Preserved http://codewala.net @code_wala https://www.facebook.com/codewala
  10. 10. Cacheable Request Response http://codewala.net @code_wala https://www.facebook.com/codewala Request Response C a c h e
  11. 11. 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
  12. 12. Layered System Load BalancerProxy Server http://codewala.net @code_wala https://www.facebook.com/codewala
  13. 13. 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
  14. 14. 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
  15. 15. 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
  16. 16. 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
  17. 17. Earlier versions of ASP.NET http://codewala.net @code_wala https://www.facebook.com/codewala
  18. 18. ASP.NET Core 1.0 http://codewala.net @code_wala https://www.facebook.com/codewala
  19. 19. Postman – Tool for Testing Web API http://codewala.net @code_wala https://www.facebook.com/codewala
  20. 20. Lets Build our First ASP.NET Web API application http://codewala.net @code_wala https://www.facebook.com/codewala
  21. 21. Content Negotiation http://codewala.net @code_wala https://www.facebook.com/codewala
  22. 22. 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
  23. 23. 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

×