Key principles
- Stateless — each request contains all necessary information; the server stores no state between requests
- Uniform interface — GET reads, POST creates, PUT/PATCH updates, DELETE removes
- Resources — nouns in URLs (
/users/42), not verbs (/getUser) - Cacheability — responses can be cached, reducing server load
Response codes
200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 404 Not Found, 422 Unprocessable Entity, 500 Internal Server Error — using them correctly makes an API self-documenting.