I have a hierarchy like this:
Work Experience (like SomeCompany.com)
└─Roles (like Project Manager)
└─Projects
So user can add his Work Experience
. To that he can add roles
with specific projects
.
I would like to GET projects
for the user id 1
, but there is only relation between projects & roles.
Do I really need to make like 4 requests to get Projects?
- Get User
- Get Work Experiences
- Get Roles
- Get Projects
So if I have more roles for different work experiences, I would have to make 20 requests just to get my projects. Isn't it not efficient? I would have to load some unnecessary data...
Is it possible to create just endpoint:
/projects
and filter it by user id ?
How it should be managed on API? For me, as frontend dev it looks quite not efficient, especially when people use mostly mobiles, so requests like this will kill your battery pretty quick.
How do you guys handle relations like this?
Thank you!