application/hal+json
API Design

Meaning

A media type identifier for HAL-formatted JSON responses in REST APIs. It signals to clients that the response body follows the HAL specification, embedding hypermedia `_links` for navigation between related resources. Developers reach for it when designing or consuming hypermedia-driven APIs that need discoverable link relations.

Primary Function

API media type specification

Communicative Purpose

Enables hypermedia-driven REST APIs by declaring a standardized format that embeds navigational links alongside resource data.

Pattern

Content-Type: application/hal+json header on responses containing HAL-formatted JSON bodies

Função primária

API media type specification

Propósito comunicativo

Enables hypermedia-driven REST APIs by declaring a standardized format that embeds navigational links alongside resource data.

Situações de gatilho

REST API design: returning resources with discoverable hypermedia links

Contextos

REST APIs, HATEOAS architectures, Spring HATEOAS, hypermedia-driven client libraries

Padrão

Content-Type: application/hal+json header on responses containing HAL-formatted JSON bodies

Colocados típicos

  • Content-Type header
  • Accept header
  • _links
  • _embedded
  • self link
  • link relations
  • HATEOAS

Substituições comuns

  • application/json — no embedded hypermedia links
  • loses discoverability

Erros comuns

Treating HAL+JSON as plain JSON — ignores _links and _embedded, breaks hypermedia navigation

Similar / contraste

application/json — plain JSON without hypermedia constraints

Interferências

Coming from plain JSON APIs: may ignore _links and _embedded fields — HAL+JSON requires parsing these for navigation

Família do chunk

  • application/json
  • application/vnd.api+json
  • application/ld+json
  • HATEOAS
  • link relations

Nuance

When NOT to use: simple CRUD APIs without hypermedia needs add unnecessary parsing overhead

Efeito pragmático

Enables self-describing REST APIs where clients can navigate resources via standardized link relations without hardcoded URLs.

Dica de memória

application/hal+json is the MIME type that tells clients 'expect JSON with a _links map for navigation' — like a treasure map where every resource points to its neighbors.

Upgrade path

HATEOAS-compliant API design with link relations and content negotiation

Frequência: LowFormulaicidade: FixedPrioridade de aquisição: Passive recognitionPrioridade de output: InputTag de espaçamento: Long-term

Log in to save chunks.