Resource & URI Design
In REST, the resource is the central abstraction. A resource is any thing worth naming and addressing — a user, an article, an order, a shopping cart. Designing an API is mostly deciding what your resources are and how their URIs read.
Resources and their relationships
Section titled “Resources and their relationships”classDiagram
class User { +id +name +email }
class Article { +id +title +body +authorId }
class Comment { +id +body +articleId +authorId }
User "1" --> "*" Article : writes
Article "1" --> "*" Comment : has
User "1" --> "*" Comment : posts Each box becomes a collection you can address (/users, /articles, /comments), and the relationships hint at how URIs nest and link.
What this module covers
Section titled “What this module covers”- Modeling resources — finding the right nouns and the right granularity.
- URI naming — the conventions that make an API predictable.
- Nesting & relationships — sub-resources versus links.
- Consistency & conventions — keeping the whole API coherent.