Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3694

Should I fetch parent resource along with nested resources in one call, fetch them in separate calls, or both (REST API)?

$
0
0

I have an API design question. If I have a resource with nested resources and half the time I need to fetch the parent along with the nested resources from the client, should I use one call to fetch these resources or would it be better (in terms of design) to fetch them in separate calls?

For example, most of the time I need to fetch a Group with its Employees. Would it be better to fetch them in one call or use two different calls (one for Group and another for Employees?

Also, would it be considered a bad practice to conditionally fetch the nested entities from one call with a conditional parameter?

Example:/group?withEmployees=true (fetch group with employees)


Viewing all articles
Browse latest Browse all 3694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>