Slide 1

Slide 1 text

REST Monday, April 9, 12

Slide 2

Slide 2 text

Define APIs Monday, April 9, 12

Slide 3

Slide 3 text

Resources Monday, April 9, 12

Slide 4

Slide 4 text

Identified by URIs Monday, April 9, 12

Slide 5

Slide 5 text

http://store-engine.com/products/123 Monday, April 9, 12

Slide 6

Slide 6 text

Product id = 123 ... http://store-engine.com/products/123 Monday, April 9, 12

Slide 7

Slide 7 text

May be nested Monday, April 9, 12

Slide 8

Slide 8 text

http://store-engine.com/products/ 123/reviews/4 Monday, April 9, 12

Slide 9

Slide 9 text

Product id = 123 Review id = 4 http://store-engine.com/products/ 123/reviews/4 Monday, April 9, 12

Slide 10

Slide 10 text

May have multiple representations Monday, April 9, 12

Slide 11

Slide 11 text

http://store-engine.com/products/ 123.json Monday, April 9, 12

Slide 12

Slide 12 text

http://store-engine.com/products/ 123.json {"created_at":"2012-04-09T03:14:02Z","des cription":"Jog and listen to tunes.", "id": 123,"price":"79.0","title":"Walkman","upd ated_at":"2012-04-09T03:14:42Z" {JSON} Monday, April 9, 12

Slide 13

Slide 13 text

http://store-engine.com/products/ 123.xml Monday, April 9, 12

Slide 14

Slide 14 text

2012-04-09T03:14:02Z Jog and listen to tunes. 123 79.0 Walkman 2012-04-09T03:14:42Z http://store-engine.com/products/ 123.xml Monday, April 9, 12

Slide 15

Slide 15 text

Rely on HTTP content type negotiation Monday, April 9, 12

Slide 16

Slide 16 text

HTTP headers Monday, April 9, 12

Slide 17

Slide 17 text

HTTP headers http://store-engine.com/products/ 123.json Monday, April 9, 12

Slide 18

Slide 18 text

Accept: application/json, text/ javascript, */*; Request header Monday, April 9, 12

Slide 19

Slide 19 text

Content-Type: application/json; Response header Monday, April 9, 12

Slide 20

Slide 20 text

CRUD via HTTP VERBS Monday, April 9, 12

Slide 21

Slide 21 text

GET POST PUT DELETE HTTP verbs Monday, April 9, 12

Slide 22

Slide 22 text

READ CREATE UPDATE DELETE Database CRUD operations Monday, April 9, 12

Slide 23

Slide 23 text

SHOW CREATE UPDATE DESTROY Rails controller actions Monday, April 9, 12

Slide 24

Slide 24 text

SHOW CREATE UPDATE DESTROY NEW EDIT INDEX Monday, April 9, 12

Slide 25

Slide 25 text

GET /products/123 HTTP/1.1 Accept:text/html Monday, April 9, 12

Slide 26

Slide 26 text

CRUD op GET /products/123 HTTP/1.1 Accept:text/html Monday, April 9, 12

Slide 27

Slide 27 text

Resource GET /products/123 HTTP/1.1 Accept:text/html Monday, April 9, 12

Slide 28

Slide 28 text

Representation GET /products/123 HTTP/1.1 Accept:text/html Monday, April 9, 12

Slide 29

Slide 29 text

GET /products/123 HTTP/1.1 Accept:text/html ProductsController#show Monday, April 9, 12