HATEOAS — Hypermedia-Driven REST APIs with Spring HATEOAS
Fast recall
Quick revision
Core answer
Whether the candidate understands HATEOAS beyond the definition and can evaluate when it's worth the complexity.
Either dismissing HATEOAS entirely or claiming it's required for REST — the right answer evaluates trade-offs.
Mention Richardson Maturity Level 3, explain when links genuinely help (state-dependent actions, third-party API consumers), and show awareness of Spring HATEOAS's WebMvcLinkBuilder.
Interview-ready guide
Interview answer
HATEOAS — Hypermedia as the Engine of Application State — is the Level 3 REST constraint where API responses include links to related resources and available actions. Clients navigate the API by following links rather than constructing URLs from documentation.
Why it matters
- A client fetching
/orders/123receives links tocancel,ship,paymentbased on the order's current state - The server controls which actions are available — a cancelled order does not include a
cancellink - Clients never hardcode URLs; URI changes on the server side do not break clients
Spring HATEOAS implementation
EntityModel.of(orderDto)wraps a DTO.add(linkTo(methodOn(OrderController.class).getOrder(id)).withSelfRel())adds aselflink using the controller method signature — type-safe, refactoring-safeCollectionModelwraps a collection with collection-level links (> self,next,prevfor pagination)
HAL format
- Spring HATEOAS produces HAL (Hypertext Application Language) by default:
{"id": 123, "_links": {"self": {"href": "/orders/123"}, "cancel": {"href": "/orders/123/cancel"}}}
In practice: most teams stop at Richardson Level 2. HATEOAS is worth implementing for public APIs where third-party clients need to discover endpoints, or for APIs where workflow state determines available actions.
HATEOAS — Hypermedia-Driven REST APIs with Spring HATEOAS
Direct Answer
HATEOAS (Hypermedia as the Engine of Application State) means API responses include links to related resources and available actions. Spring HATEOAS provides RepresentationModel and WebMvcLinkBuilder to add links programmatically. It adds value when API consumers shouldn't hardcode URLs or when available actions depend on resource state, but adds overhead for internal APIs with tightly coupled clients.
Common Mistakes & Pitfalls
Either dismissing HATEOAS entirely or claiming it's required for REST — the right answer evaluates trade-offs.
Check your understanding
Answer these without looking back at the article.
- What are the trade-offs when applying HATEOAS — Hypermedia-Driven REST APIs with Spring HATEOAS in production?
- What are the trade-offs when applying HATEOAS — Hypermedia-Driven REST APIs with Spring HATEOAS in production?
- What are the trade-offs when applying HATEOAS — Hypermedia-Driven REST APIs with Spring HATEOAS in production?
Related interview prep categories
1Want a guided curriculum order?
These modules are also sequenced in our flagship backend interview track — open it when you prefer an ordered path instead of browsing by topic.