Scrivio Interview library
ScenarioIntermediate5 min read · updated 12 November 2026

Your team debates adopting HATEOAS for an internal API consumed by three known services. Most client code hardcodes URLs anyway. What would you recommend and why?

Hypermedia only pays off when clients follow links instead of building URLs, and these three known clients hardcode URLs, so full HATEOAS would bring payload, dependency and learning costs for little benefit. A clear OpenAPI contract and contract tests give more value for known internal consumers. The pragmatic recommendation is to add self and paging links, plus links for state-dependent actions where they simplify client logic, without committing to a full hypermedia client model.

Why this question is asked

Architecture debates often turn on principles: REST says hypermedia, so we should do hypermedia. A better debate asks what the clients we actually have would do with it. Interviewers ask this scenario to see whether a candidate can weigh an architectural ideal against its real costs and benefits in a specific context. In this answer, we will recap what HATEOAS promises, look at what our three clients actually do, list the costs of adopting it, see where links still help, and end with a recommendation and how to keep the door open.

1What HATEOAS Promises

HATEOAS, hypermedia as the engine of application state, means every response carries links describing the next possible actions. Its main promise is decoupling: if clients only know the entry point and the meaning of link relations, the server can change URLs and workflow rules without breaking them. A second promise is that clients do not need to duplicate business rules, because the presence or absence of a link (cancel, approve) tells them what is allowed.

Both promises have the same precondition: the client must actually read and follow the links. A client that builds URLs from a template in its code gets none of the decoupling, however many links the server sends.

2Looking at Our Actual Clients

Here we know exactly who calls the API: three internal services, owned by teams we can talk to, deployed by the same company. Their code builds URLs from constants such as "/orders/" + id + "/cancel". They were written against documentation and generated clients, and their developers have no time budgeted to rewrite them as link-following clients.

In that situation, the decoupling promise is largely theoretical. If we change a URL, these services break whether or not we sent links. And since we can coordinate with three known teams, the problem hypermedia solves, changing a server without coordinating with unknown clients, is not our main problem.

Costs and benefits for this API
AspectFull HATEOASOpenAPI plus contract tests
URL changes without client changesonly if clients follow links; ours do notcoordinated, caught by contract tests
Client knows allowed actionsfrom links, if readfrom documented rules or a field
Payload sizelarger: _links on every resourceunchanged
Dependencies and learningSpring HATEOAS, HAL, team trainingtools the teams already use
Breaking-change detectionnot provided by itselfspec diff and contract tests in CI
For three known internal consumers, the contract route gives more value per effort.

3What Adopting It Would Cost

The costs are concrete. Every response grows by its links; for a list of 100 orders with three links each, that is 300 link objects, often several kilobytes per response. The services depend on Spring HATEOAS and its model types, which change how controllers are written and how JSON looks (HAL's _links and _embedded wrapping). Every developer on four teams must learn the model, and the three client teams would need to rewrite URL handling to get any benefit. None of this is huge, but it is all paid up front, while the benefit depends on client changes nobody plans to make.

4Where Links Still Help

Rejecting full HATEOAS does not mean rejecting links. Two kinds of link earn their place even with clients that mostly hardcode URLs. Paging links (next, prev) save clients from building cursor or page URLs and let us change the paging mechanism later; clients like them because they make loops simple. State-dependent action links, such as cancel appearing only when an order is cancellable, let a client skip duplicating a business rule, which removes a common source of bugs when the rule changes.

Java
{
"items": [
{ "id": 17, "status": "PAID",
"_links": { "self": { "href": "/orders/17" }, "cancel": { "href": "/orders/17/cancel" } } },
{ "id": 18, "status": "SHIPPED",
"_links": { "self": { "href": "/orders/18" } } } // not cancellable: no link
],
"_links": { "next": { "href": "/orders?cursor=eyJpZCI6MTh9&limit=2" } }
}
// client: while (page.next != null) page = get(page.next); simple paging loop

Notice that these links are useful to a client that ignores everything else about hypermedia. That is the test we apply: add a link when a known client will use it.

5The Recommendation

For this API, I would recommend a clear OpenAPI contract as the primary agreement, consumer-driven contract tests so the three clients' expectations are checked in our CI, and an OpenAPI diff to catch breaking changes. On top of that, we add self links, paging links and links for state-dependent actions, in a consistent format such as HAL so it can grow later. We do not commit to a full hypermedia client model, and we do not require clients to discover URLs at runtime.

This keeps the door open. If a fourth, external or generic client appears that does follow links, or the workflow starts changing often, we can extend the links we already send without a redesign.

Step throughDeciding how much hypermedia to add
  1. Do clients follow links today?
    YesConsider fuller hypermediaNoLook at specific links
  2. Would paging links simplify clients?
    YesAdd next and prev linksNoSkip them
  3. Do actions depend on state?
    YesAdd action links when allowedNoKeep a status field
  4. Contract and tests in place?
    YesDoneNoAdd OpenAPI diff and contract tests

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

6Follow-up questions

Is it wrong to call an API without HATEOAS RESTful?

By Fielding's original definition it does not meet the hypermedia constraint, but the label matters less than whether the API serves its clients well. Being clear about which constraints we follow and why is more useful than arguing about the name.

Would you ever recommend full HATEOAS for internal APIs?

Yes, when clients are generic, for example an admin UI that renders whatever actions the server offers, or when the workflow rules change frequently and many clients would otherwise copy them. Then the investment in link-following clients pays back.

How do contract tests replace what hypermedia offers?

They do not replace decoupling, but they make coupling safe. Each consumer states the requests and responses it relies on, and our build fails if a change breaks one of them, so we can change the API with confidence even though clients hardcode URLs.

7Conclusion

In this answer, we weighed HATEOAS for an internal API with three known clients that hardcode URLs. Hypermedia pays off only when clients follow links, so full adoption would cost payload size, a library dependency and learning time for little benefit, while an OpenAPI contract with contract tests gives more value. The pragmatic choice is self, paging and state-dependent action links, without a full hypermedia client model, keeping the option to go further later.

What to say in the interviewAbout 80 seconds aloud

Open with

I would recommend against full HATEOAS here, but not against links altogether. Hypermedia pays off when clients follow links rather than building URLs, so the server can change URLs and workflow rules without breaking them.

Then, if they want more

Our three clients are known internal services that hardcode URLs, and their teams have no plan to rewrite that, so we would get the costs without the main benefit: larger payloads, a dependency on Spring HATEOAS and HAL, and learning time across four teams.

For known consumers, I think a clear OpenAPI contract, consumer-driven contract tests in our CI and an OpenAPI diff for breaking changes give much more value, because they make the coupling safe.

What I would add are the links clients will actually use: self links, next and previous links for paging, which make client loops simple and let us change the paging mechanism later, and state-dependent action links like cancel appearing only when an order can be cancelled, so clients do not copy that rule.

I would use a consistent format like HAL so we can extend it later, for example if a generic or external client that does follow links comes along.

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 "Your team debates adopting HATEOAS for an internal API consumed by three known services....": https://scrivio-interview-library.netlify.app/spring-boot/rest-api-design/d5ccf925c4/