Intro to Restful API
Intro to Restful API
Purpose
Key Principles
2. Statelessness – every request contains all information needed for the server to
fulfill it.
4. Uniform Interface – use consistent resource naming and standard HTTP methods.
5. Layered System – allow intermediary layers (load balancers, proxies) without client
awareness.
Design Guidelines
• Resources & URIs: Use nouns, plural where appropriate (e.g., /users/{id}/orders).
• HTTP Methods: GET (read), POST (create), PUT/PATCH (update), DELETE (remove).
• Status Codes: 200 (OK), 201 (Created), 400 (Bad Request), 404 (Not Found), 500
(Server Error).
• Media Types: Prefer JSON (application/json) for responses; version APIs via media
type or URI prefix.
Best Practices