← Lessons

quiz vs the machine

Silver1100

System Design

Resource Naming Conventions

Choosing URL paths that read like the data model and never surprise the caller.

3 min read · intro · beat Silver to climb

Names are the contract

A REST URL should describe where a resource lives, not what you are doing to it. The HTTP verb already carries the action, so the path stays a pure noun.

Practical rules

  • Use plural nouns for collections, like a path of users or orders.
  • Identify a single item by appending its id, like users then a specific id.
  • Express hierarchy by nesting, so the orders that belong to a user sit under that user.
  • Prefer lowercase with hyphens for multi word names, and avoid verbs in the path.

Why consistency pays off

When every collection is plural and every nested path mirrors ownership, callers can predict an endpoint they have never seen. Mixing singular and plural, or burying verbs in paths, forces readers back to the docs for every call.

Keep nesting shallow. More than two levels deep usually means the deeper resource deserves its own top level path.

Key idea

Good resource names are plural nouns arranged to mirror ownership, letting callers guess URLs correctly.

Check yourself

Answer to earn rating on the learn ladder.

1. Why should the action live in the HTTP verb rather than the URL path?

2. How should ownership between resources be expressed?