liveBook · Manning

Summarized model

As explained in The Design of Web APIs, Second Edition

model=summarized is a preference value that requests a summarized representation of a created or updated resource.

A summarized model is a subset of a complete resource model. It retains the resource identifier and the main properties needed to represent a meaningful summary, commonly for search results and embedded resources. section 5.4.1 section 5.6

The Prefer header can request a summarized representation when creating or updating a resource with Prefer: model=summarized. This reduces returned data while preserving more context than an identifier-only response. section 13.5.2

Choose the model according to what consumers need:

  • Use a summarized model for list results when identifiers and meaningful main properties let consumers work without reading every resource separately. section 5.4.1 section 9.5.2
  • Embed a summarized related resource when consumers systematically need contextual details; use only an ID when the relationship is sufficient. section 8.7.3
  • Prefer a complete response after creation or update when implementation-generated values matter; use model=summarized when consumers do not need the full resource. section 9.5.2 section 13.5.2

Requesting a summarized created resource

POST /account-applications with Prefer: model=summarized requests a 201 Created response containing the summarized account application model. Prefer: model=none omits the representation, while Prefer: model=minimal returns only its ID. section 13.5.2

Figure 5.16 Starting from the complete data model, we can design summarized (essential information), minimal (only the resource identifier property), and identifier (only the resource identifier value) models.
figure

Trace how the complete model produces summarized, minimal, and identifier models. section 5.4.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Defines derivation from the complete model and selection criteria, but defers implementation-specific property design.
Examples
Uses ProductSummary, summarized owners, transaction summaries, and model=summarized for account-application creation.
What it assumes
Assumes a complete resource model exists and teaches deriving narrower models for particular operation and consumer needs.
What you can do after
Operate/configure API responses by selecting summarized output when identifiers and main properties meet consumer needs.
How it connects
Connects complete models, minimal models, identifier models, embedded resources, search operations, and the HTTP Prefer header.

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.