liveBook · Manning

Resource

As explained in The Design of Web APIs, Second Edition

A product resource is an API-represented product entity that can be addressed or manipulated by operations.

A resource is a standalone business concept or entity that an API manipulates. It uses domain terminology, can exist independently, and differs from its properties: a Product is a resource, while its name is merely data belonging to it. A property such as price may become a resource when its history must be tracked. section 3.3.1

Identify a resource by examining an operation’s description, inputs, success, and failure. The main verb usually targets one resource, while several operations can manipulate that same resource. section 3.3.2

Use these practical identification patterns:

  • For reading, updating, or deleting an element, treat the individual element as the resource. section 3.3.5
  • For creating, adding, listing, or searching elements, treat their container as the resource. section 3.3.5
  • Shorten an ambiguous operation description, or expand it with its context; “Add a product to a merchant’s catalog” identifies the merchant’s catalog. section 3.3.3
  • Derive relations from domain knowledge and operation outcomes, such as “Catalog contains Product” and “Product belongs to Catalog.” section 3.3.4

From business operation to HTTP resource

“Search for products” manipulates a catalog containing products. Represent that resource as /products, use GET for the Search action, pass filters in the query, and return product information in the response body with 200 OK. section 4.1.2

Figure 3.3 How a client application calls a REST API is identical to when a web browser loads an HTML page.
figure

Compare a REST API call with a browser request: both use an HTTP method and path, while the API returns structured business data. section 3.1.2

How The Design of Web APIs, Second Edition covers it

How deep it goes
Defines independence, properties, operation targeting, relations, and CRUD patterns, then defers detailed paths and schemas to later design steps.
Examples
Uses products, catalogs, prices, blog pages, course offerings, flights, and checkout orders to illustrate resources and relations.
What it assumes
Assumes API capability descriptions and domain vocabulary while teaching resource analysis from plain language without requiring HTTP knowledge.
What you can do after
Apply it to identify resources and relations, distinguish resources from properties, and map typical operations to HTTP representations.
How it connects
Connects resources with HTTP, REST APIs, CRUD operations, API capabilities, resource relations, data modeling, and OpenAPI schemas.

Also explained in

Compare how 3 books explain resource →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.