4. What is REST
Stands For:
REpresentational State Transfer
Architectural Style based on HTTP
10/8/2013 4
5. 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/2013 5
6. 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/2013 6
8. 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/2013 8
9. REST in Action
Actions:
GET
POST
PUT
DELETE
Resources:
http://somedomain.com/users/1
https://otherdomain.com/products
10/8/2013 9
10. REST Responses
Responses come back as an HTTP Status Code + message (maybe)
HTTP Status Codes
1XX – Request Received and I’m 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/2013 10
11. 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/2013 11