REST API fundamentals
The core ideas behind REST APIs: resources, HTTP methods, status codes and good design habits.
Overview
REST is an architectural style for web APIs. It models your domain as resources identified by URLs and manipulated with standard HTTP methods. Its ubiquity, simplicity and cacheability make it the default choice for most APIs.
Resources and methods
Resources are nouns; methods are verbs:
| Method | Purpose | Idempotent? |
|---|---|---|
| GET | Read a resource | Yes |
| POST | Create a resource | No |
| PUT | Replace a resource | Yes |
| PATCH | Partially update | No (usually) |
| DELETE | Remove a resource | Yes |
Idempotency matters: a client can safely retry an idempotent request after a network failure without side effects.
Status codes
Use them meaningfully (look any up with the HTTP status tool):
- 2xx success (
200 OK,201 Created,204 No Content). - 4xx client errors (
400validation,401unauthenticated,403forbidden,404missing,409conflict,429rate limited). - 5xx server errors.
Design habits that age well
- Consistent naming: plural nouns, e.g.
/invoices/123. - Use query params for filtering/sorting/pagination, not new endpoints.
- Paginate large collections and return the total or a cursor.
- Version your API (e.g.
/v1/) so you can evolve without breaking clients. - Return structured errors with a code and message — never leak stack traces.
- Authenticate and rate-limit every endpoint.
Consuming a REST API
Build and inspect requests with the API request builder, keep secrets in environment variables, handle 429 with backoff, and never assume the network is reliable.
Related
Last verified: August 2026. Technology and pricing change — always confirm current details with the vendor.