$devtoolkit.sh/glossary/what-is-rest-api

What is a REST API? — Representational State Transfer Explained

Definition

REST (Representational State Transfer) is an architectural style for designing networked applications, particularly HTTP-based web APIs. A REST API exposes resources (data objects like users, products, orders) at URL-based endpoints, and clients interact with these resources using standard HTTP methods: GET to read, POST to create, PUT/PATCH to update, and DELETE to remove. REST is stateless — the server does not retain information about the client between requests.

How It Works

RESTful API design organizes data around resources, each identified by a URL (e.g., /users/42). The HTTP method determines the action: GET /users returns a list, POST /users creates a user, GET /users/42 reads one user, PUT /users/42 replaces a user, PATCH /users/42 partially updates a user, and DELETE /users/42 removes it. Responses use standard HTTP status codes: 200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error. Request and response bodies are most commonly JSON.

Common Use Cases

  • Building web and mobile application backends that serve data to clients
  • Exposing platform APIs that third-party developers can integrate with
  • Integrating with payment, email, mapping, and other third-party services
  • Microservices communication over internal HTTP networks
  • Providing programmatic access to data for automation and scripting

Example

GET    /api/users          → list users
POST   /api/users          → create user
GET    /api/users/42       → get user 42
PUT    /api/users/42       → replace user 42
PATCH  /api/users/42       → update user 42 fields
DELETE /api/users/42       → delete user 42

Response: HTTP 200 { "id": 42, "name": "Alice" }

Related Tools

FAQ

What makes an API truly RESTful?
A truly RESTful API follows Roy Fielding's constraints: stateless client-server communication, uniform interface (resource-based URLs + HTTP methods), layered system (clients do not need to know if they talk to a load balancer or cache), and optionally code-on-demand. Many "REST" APIs are actually just JSON-over-HTTP and do not implement HATEOAS (links to related resources in responses).
What is the difference between PUT and PATCH?
PUT replaces the entire resource with the request body. If you PUT without including a field, that field is deleted. PATCH partially updates a resource — only the fields in the request body are changed. PATCH is preferred when you want to update specific fields without re-sending the whole object.
What is idempotency in REST?
An operation is idempotent if calling it multiple times produces the same result as calling it once. GET, PUT, and DELETE are idempotent. POST is not — each call creates a new resource. Idempotency matters for retrying failed requests safely.

Related Terms

/glossary/what-is-rest-apiv1.0.0