415 Unsupported Media Type HTTP Status Code
Description
The HTTP status code 415 indicates "Unsupported Media Type." This response status is used when the server refuses to accept the request because the payload format is in an unsupported format. Essentially, the server understands the content type of the request entity (provided in the Content-Type header), but the server either cannot process that specific media type or the media type is incompatible with the target resource for the request.
For example, if a client makes a POST request to a server with a payload in a format that the server cannot process (say, an image format where the server expects JSON data), the server might respond with a 415 Unsupported Media Type status code. This tells the client that the server refuses to process the request because the payload format is not supported for the particular resource.
This status code is part of the HTTP/1.1 standard defined in RFC 7231. It helps in ensuring that both clients and servers have a clear mechanism to communicate about the formats they can accept or provide, enhancing the interoperability and efficiency of HTTP communications.
Status
415 Unsupported Media Type
Common Causes
Here are the common causes for a 415 Unsupported Media Type error:
Incorrect
Content-Type
Header: The most common cause is when theContent-Type
header in the request is incorrect or not supported by the server. For instance, if the server is only configured to accept data inapplication/json
format, but the request has aContent-Type
oftext/plain
, the server may respond with a 415 error.API or Endpoint Specific Requirements: Some APIs or endpoints may have specific requirements for the content type they can process. If the request does not meet these requirements, the server may respond with a 415 error. This is common in RESTful APIs where specific endpoints only accept certain media types.
Lack of Server Configuration or Support: The server might not be configured to handle certain media types or lacks the necessary software or modules to process the requested content type. For instance, if a request is made with a media type that requires a specific parser or processor that the server does not have, it may result in a 415 error.
Client Error in Specifying the Content Type: Sometimes, the client may erroneously specify a content type that does not match the actual type of the data being sent. For example, uploading an image with a
Content-Type
ofapplication/json
would likely result in a 415 error because the server expects JSON data, not binary image data.Complex or Non-Standard Content Types: In some cases, the use of complex or non-standard content types that are not widely supported or recognized can lead to a 415 error. This can happen with custom media types or types that are specific to certain applications or industries.
To resolve a 415 error, ensure that the Content-Type
header is correctly set to a media type that the server supports and that the actual data being sent matches that media type. If the error persists, checking the server's documentation or contacting the server's support team for guidance on supported content types and configuration requirements may be necessary.
Browser Support
The following table will show you the current browser support for the 415 Unsupported Media Type
HTTP status code.
Desktop | |||||
Yes | Yes | Yes | Yes | Yes |
Tablets / Mobile | |||||
Yes | Yes | Yes | Yes | Yes | Yes |
Last updated by CSSPortal on: 1st April 2024