We are creating REST API which will be consumed by Web and Mobile users.
My question is: do we need to consider user interface before designing the JSON structure?
For example, we have one resource Company
. A Company
has multiple customers with its experiences
. We created API company/{company_id}/customers
to fetch the list of customers for a particular company. In response, the API is sending a list of customers with basic details like (id, name, address, email, phone).
Is a best practice to send customer experiences with customer detail?
Currently while fetching customers, we are sending only basic details of customers without their experiences. When we refer user interface for mobile and web it's showing customer's experience with customer detail in customer listing screen.
So now is that a best practice if we make multiple small REST calls to get other information?