Download Article
Why you are getting this error, what to do about it
Download Article
The 415 error, or "Unsupported Media Type" error, occurs when a file format is sent in a request that the server doesn't recognize or isn't configured to handle. This is generally a server-side issue that occurs when you are using an API (Application Program Interface). This guide teaches you the causes of this error and how to fix it.
415 Unsupported Media Type Error
A 415 error occurs when the server doesn't recognize the file format in a request. Check the "Content-Type" and "Content-Encoding," headers, as well as the "Accept" headers on the client side. Check the syntax for typos.
Steps
Section 2 of 2:
How to Fix the Error
-
Find the source of the error. You can either check the server logs or use the developer tools in a web browser to check the "Content-Type" headers and the file type that is being sent in the failing requests. You can also use a tool like Sitechecker.pro to check your code.
-
Make sure the "Content-Type" headers are correct. Check that the "Content-Type" headers in your request are correct. For example, if you are sending a JSON file, the header should read "Content-Type: application/json;" If it is an image file, the header should read something like "Content-Type: image/jpeg;". If it is a text or HTML file, the header should read "Content-Type: text/html; charset=UTF-8;".
-
Check the "Content-Encoding" headers. Make sure your request script isn't missing the "Content-Encoding" headers. Make sure they have the correct encoding (i.e., "gzip", "br").
-
Check the syntax of your code. Ensure there are no typos in your script on the client or server side. For example, if the header reads "charset=UTF8" instead of "charset=UTF-8", this could cause a 415 error. It could be something as simple as using the tag "header" instead of "headers" in your script.
-
Make sure your server can accept the request. Your server may not be configured to accept the requested file format. You may need to adjust your server configuration to allow it to accept the file format or encoding. If it's an encoding problem, you may need to add or adjust your gzip directives or enable specific modules, such as mod_deflate. [2] X Research source
-
Make sure your web app, CMS, or plug-in is configured to accept the request. If you are using a web application, a CMS such as WordPress , a plug-in or WordPress theme, make sure it is configured to handle the file type in the request. You may need to check the documentation for the web app, plug-in, or theme and see how to add new content type headers. If you need help figuring out how to do this, contact the developer.
-
Check the "Accept" headers on the client side. Make sure the client can receive the requested file. It's less common for there to be an issue on the client side, but it does happen. For example, if the server receives a JSON file, the client's "Accept" headers should read " Accept: application/json;". If the server is processing a text or HTML file, the client's header should read "Accept: text/html;". Likewise, if the server is processing an image file, it should read "Accept: image/*;" or something similar.
-
Test your application or website. After making changes to fix the error, test your application or website to make sure it can accept the requested file format. If the changes are successful, you should not receive an Error 415. If the problem persists, you may need to contact your server hosting provider or consult a professional programmer with experience in web applications. [3] X Research source
Advertisement
Expert Q&A
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
References
About This Article
Thanks to all authors for creating a page that has been read 278 times.
Advertisement