Overview

3 Observing operations from the REST angle

This chapter moves from capability identification to designing a RESTful programming interface by first grounding the reader in HTTP and REST semantics and emphasizing interoperability through proper use of standardized methods and status codes. It distinguishes RESTful APIs from web APIs that merely use HTTP as transport while misusing its semantics, and it cautions that REST is a choice, not a default, even as it promotes user-friendly, standard-aligned designs. The chapter also stresses separating needs analysis from protocol decisions, keeping discussions in plain language with subject-matter experts to avoid bias and to maintain focus on what the API must achieve.

The practical core introduces a method for observing operations from the REST angle using the API Capabilities Canvas: reorganize information around operations, then identify resources (business concepts), their relations, and the actions applied to them. It offers techniques for spotting the right resource—using the main verb’s target, shortening or expanding descriptions, and recognizing nested or hierarchical resources—and patterns that simplify common CRUD cases: creation and listing target containers, while reading, updating, and deleting target individual elements. Relations typically emerge as “contains” or “belongs to,” and the chapter advises resisting influence from existing code or databases to keep designs faithful to the domain.

Actions are derived from each operation’s main verb, after which inputs and outputs are consolidated across steps in a context-agnostic way. Inputs usually exclude the operation’s resource unless multiple instances must be addressed; naming and identifiers are clarified with subject-matter experts and refined later during data modeling. Outputs merge success and error cases across contexts, with guidance to avoid heterogeneous payloads and to treat empty search results as a success for consistency and usability. Once resources, relations, actions, inputs, and outputs are clear, the next steps are to represent them with HTTP paths, methods, and status codes, and then design fine-grained data models, all under consistent guidelines that reinforce a coherent developer experience.

We design the REST programming interface based on the capabilities identified during the needs analysis. We focus on designing a versatile API that does the right job.
CH03 F01 lauret3
A browser or curl command loads a web page by sending an HTTP request containing a standard method and a path identifying the page. The server returns with an HTTP response confirming the page is found and its content.
CH03 F02 lauret3
How a client application calls a REST API is identical to when a web browser loads an HTML page.
CH03 F03 lauret3
Some web APIs don’t respect HTTP semantics. Their creator may wrongly call them "REST" simply because they leverage HTTP.
CH03 F04 lauret3
To efficiently and accurately design the programming interface representing the API capabilities, we observe the operations information of the API Capabilities Canvas from the REST angle, represent identified elements with HTTP, and finally model data.
CH03 F05 lauret3
This API Capabilities Canvas showcases the five typical API operations: searching for elements and creating, reading, updating, and deleting an element (CRUD).
CH03 F06 lauret3
Pivoting the API Capabilities Canvas to group information around operations simplifies our work. CRUD stands for Create, Read, Update, and Delete.
CH03 F07 lauret3
We expand the API Capabilities Canvas with the Operations and Ressources tables to keep track of our findings.
CH03 F08 lauret3
Using the operations information of the API Capabilities Canvas, we identify resources, their relations, and the actions that apply to them with their input and outputs.
CH03 F09 lauret3
We leverage description, input, success, and failure to identify the resource manipulated by an operation.
CH03 F10 lauret3
We can shorten the description to identify an operation’s resource.
CH03 F11 lauret3
We can expand the description to identify an operation’s resource.
CH03 F12 lauret3
We can leverage subject-matter knowledge and API Capabilities Canvas to identify resources relations.
CH03 F13 lauret3
We leverage the operation description’s main verb to Identify the action.
CH03 F14 lauret3
We can merge multiple context-specific step inputs into a unique and context-agnostic action input.
CH03 F15 lauret3
No merging is needed when a single step uses the operation, but we may improve descriptions.
CH03 F16 lauret3
We can uncover a new use case when including the operation resource in the inputs.
CH03 F17 lauret3
We merge the inputs of the different steps and exclude the operation resource from the action’s inputs.
CH03 F18 lauret3
We merge different steps' outcomes and rephrase descriptions when listing the action’s outputs.
CH03 F19 lauret3
No merge is necessary when a single step uses the operation.
CH03 F20 lauret3
We must turn consumer-context-specific steps' outcomes into context-agnostic operation/action outputs.
CH03 F21 lauret3

FAQ

What does “observing operations from the REST angle” mean?It’s the step where you take the operations identified during capability analysis and, still in plain language, identify the resources (business concepts), their relations, the actions applied to them, and each action’s inputs and outputs. These findings are then mapped to HTTP in the next design step and later refined with data modeling.
How do I identify the resource for an operation?Look at the operation’s description and pick the noun targeted by the main verb; confirm with the operation’s inputs, success, and failure. An operation manipulates one resource, and a resource may be used by many operations. Distinguish resources (standalone concepts) from properties (data fields), and if ambiguous, shorten or expand the description. For hierarchical cases, keep qualifiers (for example, “merchant’s catalog”).
How do I identify relations between resources?Use subject-matter knowledge and the canvas’ inputs/outcomes to infer relations. Typical phrasing is “Y contains X” and “X belongs to Y” (for example, a Catalog contains Products; a Product belongs to a Catalog). Some domains may have no relations; record them when they exist.
What is an action and how do I find it?An action is the main verb applied to the resource in an operation (for example, Search, Add, Get, Modify, Remove). Use the raw verb from the description; don’t jump ahead to CRUD or HTTP methods. You’ll later map actions to HTTP (for example, GET, POST) and place inputs/outputs in requests and responses.
Why avoid discussing HTTP and REST while identifying capabilities?It keeps conversations focused on needs and avoids biasing the design toward a premature REST shape or even the wrong API type. It also prevents early debates about paths and status codes, which can distract SMEs and lead to incomplete or flawed capability discovery.
How do CRUD patterns help identify the resource?When creating/adding or listing/searching items, the resource is the container (for example, Catalog). When reading/updating/deleting, the resource is the individual element (for example, Product). This pattern also clarifies relations, typically “container contains element.”
How should I list an action’s inputs?Merge inputs from all steps that use the action into a single, context-agnostic list. Exclude the operation’s resource unless multiple instances must be disambiguated (then include a reference/identifier). Rename inputs to avoid confusion (for example, “Product information” rather than “Product”), and involve SMEs to pick meaningful identifiers.
How should I list an action’s outputs and handle contradictory outcomes?Combine all step outcomes into one outputs list, each with a description, type (success or error), and optional data. Choose types from a context-agnostic perspective. For example, search that finds nothing is typically a success with an empty result set. Avoid mixing heterogeneous content in a single output; it signals a design or modeling issue.
How do REST APIs differ from other HTTP-based web APIs?REST APIs respect HTTP semantics. For example, deleting a non-existent resource returns 404 Not Found for DELETE /resource/{id}. Non-compliant APIs may misuse methods and statuses (for example, GET /deleteX/{id} returning 200 with an error message), harming interoperability and usability.
What workflow helps reorganize the API Capabilities Canvas for this task?Create a pivot or grouped view centered on OPERATION and gather related INPUT, SUCCESS, FAILURE, STEP, USE CASE, and USER. Track findings in “Operations” and “Resources” sheets. Go operation by operation to identify resources, relations, actions, inputs, and outputs, then proceed to represent them with HTTP and model the data.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • The Design of Web APIs, Second Edition ebook for free