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}
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
...
<a rel="product-order"
href="/product/123/order">
Order
</a>
...
web sites
are already
restful
resources
representations
hypermedia
303 see other
by Mike Amundsen
by Jim Weber,
Savas Parastatidis,
Ian Robinson
by Steve Klabnik
thank you!