Resource names¶
Nouns, not verbs¶
- Actions to be executed on a resource must be expressed by an HTTP Request Method.
- An HTTP path segment must be a resource (name), i.e. a noun.
Good example¶
GET /movies/424221
POST /movies
Bad example¶
GET /getAllMovies
GET /updateBook
Plural nouns¶
In most cases a resource result is a collection. This circumstance SHOULD be accommodated by using its plural form.
Good example¶
GET /movies
GET /actors
GET /balance # <-- singular by nature
Resource aggregates¶
Sub-ressources of an aggregate SHOULD be expressed by navigating them in the request path, using an identifier where applicable.
Good example¶
GET /movies/{id}/actors
GET /movies/{id}/plot-summary
GET /movies/{movieId}/scenes/{sceneId}
If a sub-ressource is also a top-level-ressource (an aggregate root) of the same API, the API should redirect accordingly (hypermedia support):
GET /movies/{movieId}/actors/{actorId}
> Location: /actors/{actorId}