Scrivio Interview library
ScenarioIntermediate7 min read · updated 12 November 2026

A mobile team complains that rendering one screen needs seven calls to your REST API (user, orders, addresses, and so on). How do you decide between adding an aggregate endpoint, supporting field selection or embedding, introducing a backend-for-frontend, or moving to GraphQL?

We start by measuring what the seven calls actually cost: latency per call, payload size and how often the screen loads. If the pain is real, the usual answer is an aggregate endpoint or a backend-for-frontend owned by the mobile team, which keeps the core API resource-oriented. Embedding or field selection and GraphQL are also valid, but each brings caching, authorization or query-cost problems that we only accept when the client landscape justifies them.

Why this question is asked

Every team that ships a mobile app meets this complaint sooner or later. A REST API designed around clean resources (users, orders, addresses) is pleasant for the backend, but a phone on a slow network pays for every round trip. Interviewers ask this scenario because there is no single correct pattern; they want to hear how we weigh the options instead of jumping to GraphQL because it is fashionable. In this answer, we will see why many calls hurt, how to measure the problem, walk through the four options and their costs, and finish with how we would decide and who should own the result.

1Why Seven Calls Hurt on a Phone

A round trip is the time for a request to reach the server and for the response to come back. On office Wi-Fi it may be 20 ms. On a mobile network it is often 100 to 300 ms, before the server does any work. If the seven calls could all run in parallel, the screen would wait for roughly the slowest one. The problem is that they usually cannot: the app needs the user before it knows which orders to fetch, and the orders before it can fetch their shipping addresses. That chain of dependent calls is called a waterfall, and its cost adds up.

So the complaint is not really about the number seven. It is about how many of those calls sit one after another on the critical path, how much data each one returns that the screen never shows, and how often users open the screen.

Step throughThe waterfall behind one screen
Mobile appCore API
GET /users/me
user (2 KB)
GET /users/42/orders
20 orders (40 KB)
GET /addresses/7, /addresses/9 ...
addresses
GET /loyalty, /notifications, /banners
three more replies

8 messages in order. Play them, or step through them one at a time.

Three dependent steps at 250 ms each already cost 750 ms before rendering.

2Measure Before Choosing

Before we change any API, we collect numbers. We want the latency of each call from the device, not only from the server, the payload size of each response, how much of each payload the screen actually uses, and how often the screen is loaded. Client tracing or real-user monitoring gives the device view; gateway logs give sizes and frequency.

Suppose we find that the order list returns 40 KB of which the screen uses 4 KB, that three calls are dependent, and that the screen is the app's home page, opened 2 million times a day. That is worth fixing. If instead the calls run in parallel, total 300 ms, and the screen is a settings page opened rarely, the right answer may be to let the app issue the calls in parallel and stop there. Measuring first protects us from redesigning an API for a problem that is small.

3Option 1: An Aggregate Endpoint or a Backend-for-Frontend

An aggregate endpoint is one call that returns everything a screen needs. A backend-for-frontend, or BFF, is a small service that sits between one kind of client and the core APIs and offers exactly such screen-shaped endpoints. The key design choice is where it lives. If the BFF is owned by the mobile team, the core API stays resource-oriented and the mobile team can change what the home screen needs without waiting for a core API release.

Java
@RestController
class HomeScreenController { // in the mobile BFF, not in the core API
private final CoreClient core;
HomeScreenController(CoreClient core) { this.core = core; }
@GetMapping("/mobile/home")
HomeScreen home(@AuthenticationPrincipal Jwt jwt) {
String userId = jwt.getSubject();
var orders = CompletableFuture.supplyAsync(() -> core.recentOrders(userId, 5));
var loyalty = CompletableFuture.supplyAsync(() -> core.loyalty(userId));
return new HomeScreen(core.user(userId), orders.join(), loyalty.join());
} // one round trip for the phone; the fan-out happens on a fast data-centre network
}

Notice that the waterfall did not disappear; it moved. The BFF still calls the core API several times, but over a data-centre network where a round trip takes about a millisecond, and it can run independent calls in parallel. It also trims the payload to the fields the screen shows. The cost is one more service to run and the risk that business logic creeps into it; a BFF should compose and shape data, not decide prices or permissions.

4Option 2: Embedding and Field Selection

The core API itself can let clients ask for related resources and fewer fields, for example GET /users/42?include=orders,addresses&fields=name,email. This reduces calls without a new service, and it is a reasonable choice when several clients want the same small set of expansions.

But there is a catch. Every combination of include and fields is a different response, so HTTP caches and CDNs see many keys for what used to be one resource, and hit rates drop. Authorization also becomes harder: the user resource may be visible to a support agent while that user's orders are not, so every embedded resource must be checked with the rules of its own endpoint, not the rules of the parent. Teams that forget this leak data through an include parameter.

5Option 3: GraphQL

GraphQL lets each client send a query describing exactly the shape it wants, and a single endpoint resolves it. In Spring we would use Spring for GraphQL with @QueryMapping and @SchemaMapping methods. It fits best when many clients (several apps, partners, internal tools) need different shapes of the same data, because then no BFF or include list can keep up.

It brings its own problems. A client can write a very expensive query, so we need depth limits, complexity limits or persisted queries. Resolving a list of orders and then each order's address naively runs one query per order, the N+1 problem, which we solve with batch loading such as @BatchMapping. And because most queries are POST requests to one URL, ordinary HTTP caching no longer works. For one mobile screen, GraphQL is usually more machinery than the problem needs.

6How We Decide

Putting it together, the decision follows the evidence. If measurement shows the cost is small, we parallelise on the client. If one client type has screen-specific needs, a BFF owned by that client team is the cleanest. If many clients want the same few expansions, embedding in the core API is acceptable with careful caching and authorization. If many clients want many different shapes, GraphQL starts to pay for itself.

What we avoid is the tempting shortcut of adding GET /home-screen to the core user service. That couples a shared, long-lived API to one screen of one app. The next redesign of the screen then needs a core API release, and other clients inherit fields they never asked for.

Step throughChoosing a fix for a chatty screen
  1. Is the measured cost significant?device latency, payload waste, load frequency
    YesLook at who needs whatNoParallelise calls in the app
  2. One client type with screen needs?
    YesBFF owned by that client teamNoCheck the wider client set
  3. Many clients, a few shared expansions?
    Yesinclude and fields in the core APINoConsider GraphQL with cost limits

3 steps in order. Play them, or step through them one at a time.

7Follow-up questions

Who should own a BFF and its release cadence?

The team that owns the client should own its BFF, because the BFF changes whenever the screens change, and screens change on the app's schedule. The mobile team then releases the BFF with or slightly before each app release, while the core API keeps its own slower, more careful cadence. The core team still sets the rules the BFF must follow, such as calling core APIs through their public contracts and not keeping its own copy of business data.

Does HTTP/2 make the seven calls a non-issue?

HTTP/2 lets several requests share one connection in parallel, which removes connection setup costs and helps independent calls. It does nothing for dependent calls, where the app must wait for one response before it can send the next request, and it does not reduce oversized payloads. So it helps, but it rarely removes the need for a better endpoint on a hot screen.

8Conclusion

In this answer, we saw that a chatty screen is a problem of dependent round trips and wasted payload, so we measure latency, size and frequency first. A BFF or aggregate endpoint owned by the client team removes round trips without bending the core API. Embedding and field selection reduce calls but complicate caching and authorization. GraphQL fits many clients with many shapes and brings query cost, N+1 and caching work. Throughout, we keep core resources free of screen-shaped endpoints.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start by measuring rather than redesigning. I want the device-side latency of each of the seven calls, how many of them are dependent on each other, how big each payload is compared with what the screen uses, and how often the screen loads.

Then, if they want more

If it is a rarely used screen and the calls can run in parallel, the app can simply parallelise them. If it is a hot screen with a waterfall, my default is a backend-for-frontend owned by the mobile team.

It makes one call from the phone, fans out to the core APIs over the fast internal network, trims the payload, and lets the mobile team change the screen without a core API release.

Embedding with something like include equals orders is fine when several clients want the same expansions, but I would be careful about cache hit rates and about checking authorization for each embedded resource separately.

GraphQL makes sense when many different clients need many different shapes; then I would also plan for query cost limits, batch loading to avoid N plus one queries, and the loss of plain HTTP caching.

What I would avoid is adding a home-screen endpoint to the core user service, because that ties a shared API to one screen of one app.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "A mobile team complains that rendering one screen needs seven calls to your REST API...": https://scrivio-interview-library.netlify.app/spring-boot/rest-api-design/820775504f/