406 Not Acceptable
The HTTP406 Not Acceptableclient error response status code indicates that the server could not produce a response matching the list of acceptable values defined in the request'sproactive content negotiation headers and that the server was unwilling to supply a default representation.
Proactive content negotiation headers include:
A server may return responses that differ from the request's accept headers.In such cases, a200 response with a default resource that doesn't match the client's list of acceptable content negotiation values may be preferable to sending a 406 response.
If a server returns a 406, the body of the message should contain the list of available representations for the resource, allowing the user to choose, although no standard way for this is defined.
In this article
Status
406 Not AcceptableExamples
>Content type not available
The following request assumes thatwww.example.com/docs/doc1 supports sending a document back asapplication/rtf:
GET /docs/doc1 HTTP/1.1Host: example.comAccept: application/rtf;In this example, the server implementation does not fallback to a default content type liketext/html orapplication/json, but returns a 406 instead:
HTTP/1.1 406 Not AcceptableDate: Wed, 26 Jun 2024 12:00:00 GMTServer: Apache/2.4.1 (Unix)Content-Type: application/json{ "code": "UnsupportedType", "message": "Only 'text/html' or 'application/json' content types supported.",}Specifications
| Specification |
|---|
| HTTP Semantics> # status.406> |