- Hands-On RESTful Web Services with TypeScript 3
- Biharck Muniz Araújo
- 128字
- 2021-07-02 12:19:21
Resource-based APIs
This category essentially states that each resource represents a specific collection of information regarding an entity or collection of entities of a given type. Resources are organized based on the information that's provided by the domain itself. In general, APIs use the REST style to perform operations that reflect the state of a given resource. From an enterprise perspective, exposed resources based on APIs allow for mirroring key business concepts, rather than silos.
Here, you can see examples where the resource is the user and its representation is related to login and logout actions:
/users/login
/users/logout
The following example shows information such as ratings, titles, and recommendations under a specific user ID. The same idea applies to items from a given order ID:
/users/<id>/ratings/title
/users/<id>/recommendations
/stores/orders/<id>/items