Skip to Content
API Design Patterns
book

API Design Patterns

by John J. Geewax
July 2021
Intermediate to advanced
480 pages
14h 40m
English
Manning Publications
Content preview from API Design Patterns

12 Singleton sub-resources

This chapter covers

  • What singleton sub-resources are
  • Why and when we should split data off into a singleton sub-resource
  • How standard methods interact with sub-resources
  • Where singleton sub-resources live in the resource hierarchy

In this pattern, we’ll explore a way of structuring related but independent data by moving it from a set of properties on a resource to a singleton child of that resource. This pattern handles scenarios where a specific collection of data might change independently of the parent, have different security requirements, or simply might be too large to store directly as part of the resource.

12.1 Motivation

When building APIs, we sometimes have situations where there are components of resources ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Designing Web APIs

Designing Web APIs

Brenda Jin, Saurabh Sahni, Amir Shevat

Publisher Resources

ISBN: 9781617295850Publisher SupportOtherPublisher WebsiteErrata PagePurchase Link