stackbook.io
🔍
← Back to Syllabus
Day 1Level 2 — API Craft

Resource Modelling and Naming

Learn: 30 minMap: 20 minDesign: 45 min

Core Concepts (5)

  • 1.Resources are nouns that map to business entities, not database tables
  • 2.HTTP methods carry semantics: safe, idempotent, or neither
  • 3.Stable identifiers outlive any internal storage layout
  • 4.Collections and sub-resources express ownership
  • 5.Naming consistency is a feature consumers feel every day

Map to Your Experience

Think of an API you have integrated with. Which endpoint names surprised you, and what did you have to guess?

Design Brief: Model a Booking API

Learn

An API is a product whose users are developers, and its first job is to be predictable. The cheapest way to achieve that is to model resources: the nouns of your business such as a reservation, an invoice, or a customer. A resource is not a database table. Tables change when you refactor storage, while resources are promises you make to people who cannot see your internals.

HTTP gives you a small vocabulary. GET reads and must have no side effects. PUT replaces and can be repeated safely. DELETE removes and is also safe to repeat. POST creates or triggers work and is not safe to repeat by default. Choosing the right method tells clients, caches, and proxies what they may retry, cache, or prefetch without asking you.

Identifiers deserve care. Use opaque, stable identifiers that never encode storage details, and never reuse them. Nest a resource under its parent only when it cannot exist without it, for example reservations under a venue slot. Deep nesting becomes awkward quickly, so link to related resources by identifier once the hierarchy passes two levels.

Not every action is a noun. Cancelling a reservation or sending an invoice are verbs. You can model them as a state field changed through an update, or as a sub-resource such as a cancellation. Pick one convention and apply it everywhere, because inconsistency costs consumers more than any single imperfect choice.

Finally, write names for readers. Prefer plural collection names, consistent casing, and full words over abbreviations. Once a name ships, it is nearly impossible to remove, so treat naming review as seriously as schema review.

Map

Pick three operations in a product you know, such as cancel an order, list payments, or update a profile. For each, write the resource, the HTTP method, and whether a client may safely repeat the call after a timeout. Mark any operation that does not fit cleanly as a noun.

Design

Produce a one-page resource map for the booking service: resources, identifiers, URL shapes, and methods. Then write three sentences on which name or nesting choice you would regret most in two years and what you did to reduce that risk. Keep your answer concrete: name real numbers, owners, and examples wherever you can, and note any assumption you had to make so a reviewer can challenge it.

Requirements

  • •List resources with identifiers and URL shapes
  • •Map each operation to an HTTP method
  • •Show ownership between resources

Constraints

  • •Public API for external partners
  • •No breaking renames after launch

Must Cover

resourceshttp-semanticsidentifiers

Trade-off Axis

expressiveness vs simplicity

Referenced Patterns

Competencies Advanced

distribution communication → L2requirements constraints → L2

Ready to Design?

Open this day in the Design Studio. The studio follows this track: its days, concepts, patterns and trade-offs are loaded, and you keep one design across the whole track.

Open in Studio →