Skip to content

HTTP Code 415 Unsupported Media Type

HTTP Status Code 415 – Unsupported Media Type

The 415 Unsupported Media Type status code indicates that the server refuses to accept the request because the payload is in a format that is not supported by the server for the target resource. This is typically due to the client specifying a Content-Type in the request header that the server does not support or recognize.

Example 1: Unsupported Content-Type in a POST request

Consider a server API endpoint that only accepts JSON payloads. If a client sends a request with a different format, such as XML, the server will respond with a 415 status code.

POST /api/data HTTP/1.1
Host: example.com
Content-Type: application/xml

<data><value>Example</value></data>

Response from the server:

HTTP/1.1 415 Unsupported Media Type
Content-Type: text/html; charset=UTF-8

<html>
<head><title>Unsupported Media Type</title></head>
<body>
    <h1>415 Unsupported Media Type</h1>
    <p>The request payload format is not supported by the server.</p>
</body>
</html>

Example 2: Image upload with incorrect format

Imagine a server that only accepts image uploads in JPEG and PNG formats. If a client attempts to upload an image in BMP format, the server will reject the request with a 415 status code.

POST /upload/image HTTP/1.1
Host: example.com
Content-Type: image/bmp

...binary image data...

Response from the server:

HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json

{
    "error": "Unsupported Media Type",
    "message": "The server only supports JPEG and PNG image formats."
}

 

 

Example 3: Another Scenario

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 415 415 Unsupported Media Type
Date: Wed, 09 Oct 2024 23:05:03 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 415"
}

Summary

The 415 Unsupported Media Type status code is a client error response indicating that the server cannot process the request due to an unsupported format specified in the Content-Type header. To resolve this issue, the client should ensure that the request payload is formatted in a way that the server can understand and process. This often involves verifying the server’s API documentation to confirm supported media types.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top