REST (Representational State Transfer) is an architectural style for networked applications, not a strict protocol. It organizes APIs around resources—such as users, orders, or products—identified by URLs. Clients interact with them through standard web verbs, and each request carries the context needed to process it. section 6.9.1
Think of a resource URL like a vending-machine slot: request a specific item in a standard way, and get its response.
- Uniform interface: access resources through standard URLs and verbs such as GET, POST, and DELETE. section 6.9.1
- Statelessness: each request includes the context needed for the server to handle it. section 6.9.1
- Cacheability: responses indicate whether they can be saved and reused, reducing network traffic. section 6.9.1
A simple contract is predictable and cacheable, but a response may contain more than a client needs. A product request might return its name, price, calories, ingredients, and manufacturer even when the screen needs only the name. A fields query parameter can narrow the response as a middle ground to GraphQL. section 6.4.1
Listing 6.1 REST Response
// REST Response: #A
{
"id": "123",
"name": "Salt & Vinegar Chips",
"price": 1.50,
"calories": 250,
"ingredients": [ "Potatoes", "Oil", "Salt"... ],
"manufacturer": { "name": "SnackCorp", "address": "123 Food Lane" }
}The sample product response shows how one resource can return several fields and nested manufacturer data. section 6.4.1
Choose verbs with retries in mind
GET /orders/1 can be repeated without changing the order. PUT /orders/1 can set its status to Shipped repeatedly and leave it Shipped. DELETE /orders/1 remains deleted after repeated requests. POST /orders is different: repeating it can create multiple charges. Choose a verb for its behavior, not just because it sounds right. section 6.4.1
REST describes principles behind the web’s resource-based approach. It offered a simpler alternative to heavyweight distributed-system protocols such as SOAP and CORBA, rather than introducing a new technology. section 6.9





























