Accept
Tells the server which media types the client can handle. Optional q values set priority (0–1).
RequestSyntax
Accept: <media-type>[/<params>][; q=<qvalue>]Example values
| Value | Explanation |
|---|---|
| application/json | Prefer JSON |
| text/html, application/xhtml+xml; q=0.9, */*; q=0.8 | HTML first, then anything |
| application/json, application/xml | JSON or XML |
cURL usage
curl -H "Accept: application/json" https://api.example.com/users
Common mistakes
Not setting Accept for APIs (server may return wrong format); wrong q-value order.