REST APIs
REST APIs leverage HTTP methods to manage resources identified by URIs, enabling scalable, flexible web services.
REST APIs model applications as a collection of resources identified by unique URIs. Clients interact with these resources using a fixed set of operations, commonly mapped to HTTP methods (GET, POST, PUT, PATCH, DELETE). Key constraints include: statelessness (no server-side client context between requests), a uniform interface (standardized methods, URIs, and media types), client–server separation, cacheability, and a layered system. Representations (typically JSON or XML) are transferred over HTTP, and content negotiation, versioning, and HATEOAS (optionally) guide client interactions. REST is an architectural style, not a protocol, and while it aligns well with the web, practical RESTful design requires balancing over-fetching, under-fetching, and security concerns such as authentication, authorization, and transport security (TLS).
graph LR
Center["REST APIs"]:::main
Pre_http["http"]:::pre --> Center
click Pre_http "/terms/http"
Pre_api["api"]:::pre --> Center
click Pre_api "/terms/api"
Rel_apache_http_server["apache-http-server"]:::related -.-> Center
click Rel_apache_http_server "/terms/apache-http-server"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 Explain Like I'm 5
Like a vending machine: clear distinct items (Resources) you can get or interact with using standard buttons ([HTTP](/en/terms/http) methods), and it doesn't remember you (Stateless).
🤓 Expert Deep Dive
Proper RESTful design uses correct HTTP status codes (200 OK, 201 Created, 404 Not Found). Idempotency is key for methods like PUT and DELETE. HATEOAS provides navigation links in responses.