Skip to main content
PreparationZone Logo
PrepZone

HATEOAS and Hypermedia Links

EntityModel links, Richardson level 3, and when a BookStore API should skip HATEOAS.

Pass checkpoint below

Why this matters

  • Interviewers ask why REST is more than JSON over HTTP, and HATEOAS is the answer that separates Richardson maturity level 2 from level 3.
  • Clients that hard-code /api/books/42/orders break when you version or rename paths. Links discovered from the payload survive those changes.
  • HATEOAS is also easy to over-apply. Knowing when a stable OpenAPI contract is the better choice is part of the senior answer.

Links in the payload

L1 · Fresher

A book response includes self, author, and orders links so the client follows URIs instead of assembling them.

Spring HATEOAS

L2 · Intermediate

spring-boot-starter-hateoas adds EntityModel, CollectionModel, and WebMvcLinkBuilder.linkTo for type-safe link building.

Affordances

L3 · Advanced

Links can carry HTTP method and request shape. A client discovers that DELETE is offered only when the caller may remove the book.

When to skip it

L4 · Expert

Mobile apps and BFF layers with a published OpenAPI spec rarely walk hypermedia. Use HATEOAS on public, long-lived APIs where you cannot ship a client update with every URI change.

Add the starter

Java
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>

The starter brings Spring HATEOAS and configures Jackson to render _links on RepresentationModel types.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 4 sections

  • A book resource with links
  • Advantages
  • Disadvantages
  • Conditional links

Test yourself

Answer these before moving on — recall is what makes it stick.