Content negotiation
Also called: representation negotiation, Accept, Vary
Content negotiation chooses a representation of a resource using information such as acceptable media types, languages or content encodings. In server-driven negotiation, request fields such as Accept or Accept-Language provide preferences; the server chooses among the representations it can supply.
A hypothetical report endpoint might return JSON to one client and HTML to another at the same URL. The response’s Content-Type identifies the chosen form. When selection depends on a request field, Vary tells caches to account for it. Preferences do not guarantee that every requested format is available.
- Read first
- HTTP headers
- Related
- HTTP headers, HTTP caching, REST
- Further reading