
上QQ阅读APP看书,第一时间看更新
Resource modelling
Resource modeling is one of the primary aspects for API designers as it helps to establish the API's fundamental concepts.
In an earlier section, we saw details about the URI; let's consider, in general, the URI path always convey REST resources, and each part of the URI is separated by a forward slash (/) to indicate a unique resource within it model's hierarchy.
Let's take the following sample URI designs:
- https://api-test.lufthansa.com/v1/profiles/customers/memberstatus
- https://api-test.lufthansa.com/v1/profiles/customers/accountbalance
Each resource separated by a forward slash indicates an addressable resource, as follows:
- https://api-test.lufthansa.com/v1/profiles/customers
- https://api-test.lufthansa.com/v1/profiles
- https://api-test.lufthansa.com
Customers, profiles, and APIs are all unique resources in the preceding individual URI models. So, resource modelling is a crucial design aspect, and API designers need to think about the API resource model before they move on to designing URI paths.