RESTFUL API

A RESTful API is an API that follows the ideas of REST (Representational State Transfer). You expose resources (e.g. users, orders, products) as URLs, and clients use standard HTTP methods to read or change them. The server doesn’t keep client state between requests; each request carries what’s needed.

Resources and URLs

Everything you can access is a resource, identified by a URL (path). Use nouns, not verbs: /users, /orders/123, /products. The same URL can represent a collection (/users) or a single item (/users/42). Keep URLs clear and hierarchical.

HTTP methods

Clients say what they want to do with the resource by choosing the right method:

Status codes

The server responds with an HTTP status code so the client knows the outcome:

1xx Informational

2xx Success

3xx Redirection

4xx Client error / 5xx Server error

Statelessness

Each request is independent. The server doesn’t store client “sessions” for REST; any auth or context is sent in the request (e.g. headers like Authorization). That makes the API easy to scale and reason about.

Summary

Design your API around resources and URLs, use GET/POST/PUT/PATCH/DELETE correctly, return the right status codes, and keep the server stateless. That’s the core of a RESTful API.

← Back to concepts