@simonrenoult | srenoult@octo.com
[{ "id":"007", "first_name": "John", "last_name": "Lennon", "age": 76, "gender": "M", "albums": "/v1/people/007/albums" }]
GET
POST
PUT
DELETE
PATCH
Read something. No side-effect.
Create something.
Update or create something.
Remove something.
Update (partially) something.
Verbs?
No, HTTP takes care of that
Resource
We manipulate (HTTP verb) a resource (noun)
CamelCase
Snake_case
Spinal-case
GET /v1/orders?userId=007
GET /v1/orders?user_id=007
GET /v1/orders?user-id=007
200
201
204
206
OK
Created
No content
Partial content
GET /people
POST /people
DELETE /people
400
401
403
404
Bad request
Unauthorized
Forbidden
Not Found
500
503
Internal Server Error
Service Unavailable
Do NOT stick to the spec at any price.
Be affordable first.
Curl
Swagger
Always provide curl samples
Open API Spec. (fev 2016)
Use HTTP.
Be simple.
Ship it.
Questions?
Thanks.
http://vinaysahni.com/best-practices-for-a-pragmatic-restful-api
https://httpstatuses.com/
http://blog.octo.com/designer-une-api-rest
By Simon Renoult
Set of good practices (seen on the ground) to design a good RESTful API.