406 Not Acceptable
The HTTP status meaning the server cannot produce any format the Accept header asked for.
In more detail
Answering 406 is more honest than sending a format the client said it cannot read. A server may instead choose to send its default format, but it must never claim a format it did not send.
Example
In the APIs course: The course service is JSON only, so Accept: application/xml gets 406 with a problem document.Related terms
- Accept header — The request header in which a client lists the formats it can read, such as Accept: application/json.
- content negotiation — The way a client and server agree on the format, language or compression of a response using request headers such as Accept.
Taught in
- Headers And Content Negotiation — Modern API Architecture: REST, GraphQL & gRPC