liveBook · Manning

Data inlining

As explained in API Design Patterns

Data inlining is storing related information directly within a resource instead of representing it as a separate resource.

Data inlining stores related information directly inside a resource rather than linking to a separate resource. It can simplify common reads, but increases payload size, query work, and consistency concerns when the embedded data is shared or changes frequently. section 4.2.2 section 4.3.3

ChatRoom administrator

A ChatRoom can contain an adminUser object, allowing the administrator’s name to be returned in one API call. A reference instead stores adminUserId and requires a second call to retrieve the User. Prefer inlining when the information is commonly needed; prefer a reference when it is infrequently used or produces substantial extra data. section 4.2.2

Apply these checks before inlining:

  • Inline data that answers frequent resource queries without another network request. section 4.2.2
  • Avoid inlining infrequently used data, deeply nested data, or shared values that must remain consistent across resources. section 4.2.2 section 4.3.3

How API Design Patterns covers it

How deep it goes
Explains retrieval costs, payload overhead, computation, and shared-data integrity, stopping short of implementation-specific resolution strategies.
Examples
Compares ChatRoom administrators represented inline or by reference, then contrasts Book resources with embedded or separate Authors.
What it assumes
Assumes familiarity with API resources and requests while developing the distinction between references and embedded data.
What you can do after
Evaluate API resource designs by weighing call count, response size, computation, access frequency, and shared-data consistency.
How it connects
Connects resource hierarchy, API references, denormalized schemas, data integrity, and network requests.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.