A resource is a web-accessible thing—such as a user, order, or product—identified by a URL and accessed through standard web operations. Think of a vending machine: each slot is an address, and pressing its button returns the item assigned to that slot. section 6.4.1 section 6.9.1
Designing around resources makes API behavior easier to predict:
- Use standard verbs such as GET to read, POST to create, and DELETE to remove. section 6.9.1
- Make each request self-contained: the server should not need to remember session state between requests. section 6.9.1
- Choose verbs with retry behavior in mind: repeating a GET, PUT, or DELETE leaves the same result, while repeating a POST can create multiple charges. 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" }
}A product resource response shows how one URL can return the whole product record—even when a client only needs its name or price. section 6.4.1


