Lesson 20 / 24

HATEOAS at a Glance

Letting responses tell the client what it can do next.

Hypermedia as the engine of state

HATEOAS says a response should include links to related/next actions, so a client discovers the API by following links rather than hardcoding every URI upfront — like a website with clickable links instead of a memorized map.

Links in the response

The available next steps travel with the resource itself.

{
  "id": 482,
  "status": "pending",
  "_links": {
    "self": { "href": "/orders/482" },
    "cancel": { "href": "/orders/482/cancel", "method": "POST" }
  }
}

Rarely used in full

Full HATEOAS is uncommon outside a few standards (like HAL or JSON:API) — most public APIs skip it in favor of documented, fixed URIs. Know the idea; don't feel obligated to implement it everywhere.