REST
REST (Representational State Transfer) is an architectural style for designing networked interfaces in which applications communicate over the HTTP protocol and data is treated as resources that each have a unique address (URL). An interface built to REST principles is called a RESTful API, and it is today the most common way to exchange data between front ends, mobile apps and external services.
How REST works
In REST, every resource — a user, an order, a product — has its own address, and operations on it are expressed with standard HTTP methods:
- GET — retrieve a resource (for example a list of orders),
- POST — create a new resource,
- PUT / PATCH — update an existing resource,
- DELETE — remove a resource.
Responses are most often returned as JSON, and the outcome of each operation is signalled by HTTP status codes (200, 201, 404, 500). A defining trait of REST is statelessness: the server does not remember previous requests, so every request must be self-contained. Good practices also include a consistent URL structure, API versioning and disciplined use of status codes.
REST in practice
REST underpins most modern APIs: a mobile app fetches data from a server, a store integrates with a payment system, and an admin panel talks to the backend all through REST calls. Statelessness makes horizontal scaling easy — you can add servers without sharing sessions, which pairs well with running an application on VPS servers behind a load balancer. Alternatives to REST include the older SOAP and the newer GraphQL, but for most web use cases REST remains the default choice thanks to its simplicity and ubiquity.
Powiązane pojęcia
Najczęstsze pytania
How is REST different from SOAP?
SOAP is a rigid XML-based protocol with elaborate security and transaction standards. REST is a lighter architectural style using plain HTTP and usually JSON. REST is simpler to implement and dominates public web APIs, while SOAP still appears in enterprise systems.
What does it mean that REST is stateless?
Statelessness means the server keeps no information about a client's previous requests. Each request must carry everything needed to process it, including authentication. This makes scaling easier because any server can handle any request.
