Stands for "Representational State Transfer." REST is a defined set of standards for transferring resources over the web. The REST method is commonly applied to APIs ("REST APIs"), which allow developers to access data from remote systems over the Internet.
REST defines six architectural constraints:
- Client-server model – a server processes client requests, and clients can only access required data from the server
- Stateless – requests are transient and no client data is stored on the server
- Cachable – requests can be cached to improve performance
- Uniform interface – access to data must be consistent for all users and systems
- Layered system support – requests can be processed hierarchically and routed across multiple systems
- Code on demand (optional) – servers can deliver executable code to client systems
REST vs. SOAP
REST is often contrasted with SOAP, another set of standards for transferring data over the Internet. However, REST is simply a design style, while SOAP is an actual protocol with specific rules and commands. Both REST and SOAP APIs transmit data over HTTP, but SOAP is limited to XML data, while REST is more flexible.
Because SOAP is an official protocol, all messages sent via SOAP must use the same "envelope" format, with a header and body. REST, which came after SOAP, has fewer constraints and is often considered a lightweight alternative to SOAP.
NOTE: APIs that conform to REST guidelines are technically called "RESTful APIs," but many developers refer to them as "REST APIs" instead.