I am consuming web-service in my spring boot application.I need to fetch information from apis. This information can be fetched by calling different nested apis:
- getAllColleges - gives ids of all colleges
- /college/{id}/departments - gives id of departments of a college
- /college/{id}/department/{dId} - Gives details of a department which includes staff information
As of now i understand that first i have to fetch all colleges using first api and iterate over them.In each iteration i will have to call again next api and get a bunch of departments and there will be a nested iteration on departments and then i'll get staff information using another api.
Is there any better approach so that so much iteration (and obviously calling apis in each iteration) can be avoided.