HTTP 415 Unsupported Media Type — What It Means & How to Fix It
About HTTP 415 Unsupported Media Type
The HTTP 415 Unsupported Media Type status code indicates the server refuses the request because the content type or encoding is not supported. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: This occurs when the Content-Type header in the request does not match what the server expects.. Common when sending JSON to an endpoint that expects form data, or vice versa.. The server should indicate which content types are accepted.. Check both Content-Type and Content-Encoding headers.. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Sending application/json when the server expects application/x-www-form-urlencoded.. Missing Content-Type header on a POST or PUT request.. Using an unsupported content encoding.. Sending XML to a JSON-only API endpoint.. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Check the API documentation for the expected Content-Type.. Set the correct Content-Type header in your request.. Ensure the request body format matches the Content-Type header.. Try common content types: application/json, application/x-www-form-urlencoded, multipart/form-data.. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What does HTTP 415 mean?
It means the server does not support the content type specified in your request. Check the Content-Type header and ensure it matches what the API expects.
Overview
The HTTP 415 Unsupported Media Type status code indicates the server refuses the request because the content type or encoding is not supported.
Key Details
- This occurs when the Content-Type header in the request does not match what the server expects.
- Common when sending JSON to an endpoint that expects form data, or vice versa.
- The server should indicate which content types are accepted.
- Check both Content-Type and Content-Encoding headers.
Common Causes
- Sending application/json when the server expects application/x-www-form-urlencoded.
- Missing Content-Type header on a POST or PUT request.
- Using an unsupported content encoding.
- Sending XML to a JSON-only API endpoint.
Steps
- 1Check the API documentation for the expected Content-Type.
- 2Set the correct Content-Type header in your request.
- 3Ensure the request body format matches the Content-Type header.
- 4Try common content types: application/json, application/x-www-form-urlencoded, multipart/form-data.