Content Negotiation
ELI5 — The Vibe Check
Content negotiation is when the client and server agree on what format to use for the response. The client says 'I prefer JSON but I'll take XML' and the server picks the best option it supports. It's like ordering at a restaurant — 'I want the steak medium-rare, but medium works too.'
Real Talk
Content negotiation is an HTTP mechanism where the client specifies preferred response formats via Accept headers, and the server selects the best representation. It covers media type (JSON vs XML), language (en vs fr), encoding (gzip vs br), and character set. Server-driven negotiation uses request headers; agent-driven uses links.
When You'll Hear This
"Our API supports content negotiation — send Accept: application/xml to get XML." / "Content negotiation lets the same endpoint serve JSON to APIs and HTML to browsers."
Related Terms
Header
Headers are the metadata attached to HTTP requests and responses — information about the information.
MIME Type (Multipurpose Internet Mail Extensions Type)
A MIME type is a standardized label for what type of content something is. 'text/html' means HTML. 'image/jpeg' means a JPEG image.
REST (Representational State Transfer)
REST is a set of rules for how APIs should behave. Think of it as the etiquette guide for servers and clients talking to each other.