Skip to main content 7nolikov | Dmitrii Novikov

HAL - Hypertext Application Language

A tiny convention for putting links inside JSON API responses, so clients navigate instead of building URLs by hand.

json code snippet start

{
  "_links": {
    "self": { "href": "/orders/123" },
    "customer": { "href": "/customers/456" }
  },
  "id": 123,
  "status": "shipped"
}

json code snippet end

That’s essentially the whole spec. The client follows _links.customer instead of knowing that customers live at /customers/{id} - so the server can move things without breaking anyone.

In practice most APIs skip this and hardcode URL patterns on the client. Worth knowing what the alternative looks like before deciding that.

HAL specification

See also: