What are the primary principles of REST APIs?
A brief intro to a big topic.
REST stands for "Representational State Transfer" and is an architectural style (not a protocol or standard) that dictates how a web service API is designed. There are several different facets to it, but the most prominent principles are as follows:
- Client-Server Architecture
- REST APIs have a traditional client-server relationship.
- A "client" (e.g. mobile app, web browser, etc) issues the request. It also typically handles the user interface.
- A "server" is where the data and logic reside.
- Statelessness
- The core idea here is that each request from the client to the server needs to have all the information needed to understand the request.
- The server doesn't store any client context between requests.
- Cacheability
- This means that the responses from the server can be stored (cached) by the client to improve performance and reduce load.
- Even though responses can be cached, they don't have to. The API server can designate some data as not cacheable so the client doesn't store outdated data.
- Uniform Interface
- The system uses a consistent and standardized way to interact with resources.
- This is typically achieved through standard HTTP methods (e.g. GET, POST, PUT, DELETE, etc)
- Layered System
- RESTful APIs support intermediary layers (e.g. proxies or gateways). The client doesn't have to communicate with the end server.
- This helps improve scalability and security.
- Code on Demand (Optional)
- This optional constraint allows servers to extend client functionality by transferring executable code (like JavaScript) to be executed on the client.
This barely scratches the surface of the topic but hopefully it's a good primer. For more information check out the following resources:




