REST

You're Doing It

WRONG

…otherwise

why are

you here?

the

web

is...

integration

without

coupling

simplicity

through

uniformity

performance

through

scalability

you might

not need

that!

is it restful?

POST /REST.svc

<PlaceOrder>
  <Product> 123 </Product>
  <Price> 19.90 </Price>
  <Qty> 2 </Qty>
</PlaceOrder>
        
POST /REST.svc

{
  PlaceOrder: {
    Product: 123,
    Price: 19.90,
    Qty: 2
  }
}
        

Richardson REST

maturity

model

Level 0

Level 1: uri

Level 2: http

Level 3: hypermedia

is it restful?

/products/books/can-haz-rest
/products?title=can-haz-rest
/Y2FuLWhhei1yZXN0%3D
        
/rest.svc?op=Order&
  product=123&qty=2
        

rpc & uri

tunneling

uri's are

opaque

what about

uri templates?

/user/{id}

make them

discoverable

(Consider: URI Template RFC)

uri identifies

resource, not

representation

GET /product/123

Accept:
  application/vnd.example+xml;v=2,
  application/vnd.example+xml,
  application/xml
Accept-Language: de, fr, en
        
200 OK

Content-Type:
  application/vnd.example+xml;v=3
Language: de-DE

<body/>
        

embrace

http

GET

idempotent, safe

POST

non-idempotent, unsafe

PUT

idempotent, unsafe

DELETE

idempotent, unsafe

beware of

CRUD

design api

with resources

not http verbs

hypermedia is

links & forms

/product/123/order

<form action="/orders"
  method="POST">
  <input type="hidden"
    name="product" value="123" />
  <input type="text"
    name="quantity" value="1" />
...
        

web sites

are already

restful

resources

representations

hypermedia

303 see other

Building Hypermedia APIs

by Mike Amundsen

REST in Practice

by Jim Weber,
Savas Parastatidis,
Ian Robinson

@hypermediaapis
on twitter

by Steve Klabnik

thank you!

REST: you're doing it wrong

Sergey Shishkin

http://shishkin.github.com/presentations/rest
@sshishkin