Hi Everyone ,
I have a question regarding designing the REST API for mobile application.
Assuming I am designing a REST API for dashboard screen in mobile app.which fetches data from multiple tables in the database.
In this case, what is the ideal approach?
- One rest API to fetch all the data at once.
- Multiple rest API that fetches data from each database table.which may involve the second API to be called after the success of the first API.
Considering clean code practices like
- Separation of code concerns
- CPU usage/ and User experience on the app
Please share your experience on what should be the approach in such cases.
Thank you
Top comments (3)
It depends on your architecture. Having a single call means spending propagation time once: it will affect your loading times for sure. If there are several micro services you could provide a GraphQL layer to address that. Otherwise, if there is only one service you can add a new endpoint to provide all data needed.
Adding GraphQL layer seems to be a good apporach :)
Nice Question, Check below post.
softwareengineering.stackexchange....
Hope this helps.