Download presentation
Presentation is loading. Please wait.
Published byAngelina Ortiz Modified over 10 years ago
1
How to Build a REST API Using ASP.NET Web API Fernando Cardenas 10/8/20131
2
Goals Understand REST What Why Get comfortable with ASP.NET Web API 10/8/20132
3
Agenda Quick Demo REST and Why You Should Care Building an API with ASP.NET Web API 10/8/20133
4
Demo 10/8/20134
5
What is REST Stands For: REpresentational State Transfer Architectural Style based on HTTP 10/8/20135
6
What is HTTP? Well defined protocol (web browsers, web servers, etc.) Request and Response Stateless Request Contents URL HTTP Verb Header Message Body 10/8/20136
7
What is REST Architectural Style based on HTTP Resources (Things) Verbs (Actions) GET, POST, PUT, DELETE, etc. Response gives a representation of the resource (XML, JSON, image, etc.) More Info: http://en.wikipedia.org/wiki/REST 10/8/20137
8
Resources GET http://en.gravatar.com/userimage/7361283/02c115a8f3967a.jpg GET https://www.diigo.com/user/jfjcn1/webApi 10/8/20138
9
HTTP Verbs GET Gets 0 or more of a resource (thing) POST Creates a resource (hopefully) PUT Updates a resource (hopefully) DELETE Deletes a resource (hopefully) 10/8/20139
10
REST in Action Actions: GET POST PUT DELETE Resources: http://somedomain.com/users/1 https://otherdomain.com/products 10/8/201310
11
REST Responses Responses come back as an HTTP Status Code + message (maybe) HTTP Status Codes 1XX – Request Received and Im processing it 2XX – Request Received and processed it successfully! 3XX – Client must do something else to complete the request 4XX – Client made an error 5XX – Server error 10/8/201311
12
Popular Status Codes 200 – Success 201 – Created 301 – Moved Permanently (AKA redirect) 404 – Not Found 401 – Unauthorized 500 – Internal Server Error (AKA oh crap!) 10/8/201312
13
On to the codez… 10/8/201313
14
Why REST? Everyone/everything speaks HTTP Web applications are moving to JavaScript + AJAX Lightweight compared to SOAP Caching of resources (server decides) http://en.gravatar.com/userimage/7361283/02c115a8f3967a.jpg 10/8/201314
15
REST is NOT a standard 10/8/201315
16
Thank You! fernando@TalentRiot.com http://kaizencto.com @avfernando 10/8/201316
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.