A hierarchical path is a URI path whose segments express parent-child relationships among resources. The final segment supplies the fundamental meaning; preceding segments add context. section 4.2.4 section 9.3.2
Catalog products
Use /catalog/123456 or /products/123456 to express that product 123456 belongs to a catalog or product list. Prefer /catalog/123456 over /123456/catalog because the parent precedes the child. section 4.2.4
Design hierarchical paths by applying these checks:
- Give every segment a clear purpose and keep resource naming consistent, such as /accounts/{accountId}/transactions. section 9.3.1 section 9.3.2
- Shorten paths when a globally unique identifier makes parent parameters unnecessary; retain them when identity depends on the parent. section 9.3.3
Figure 9.3 We question user needs and use globally unique IDs to reduce the number of path parameters in the Banking API resources paths and make them easier to use.
Compare banking resource paths and identify where globally unique identifiers can remove unnecessary path parameters. section 9.3.3
