REST API: "Error 415 Unsupported Media Type"
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When executing a REST API call, the following error is returned (using curl
as an example):
1
2
3
4
5
6
7
8
9
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 415 Unsupported Media Type</title>
</head>
<body><h2>HTTP ERROR 415</h2>
<p>Problem accessing /rest/api/1.0/rest-service/reviews-v1. Reason:
<pre> Unsupported Media Type</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
In the atlassian-fisheye-yyyy-mm-dd.log
the following stack-trace can be seen:
1
2
3
4
5
6
7
8
9
10
2012-12-10 14:19:37,263 ERROR [btpool0-2 ] com.atlassian.plugins.rest.common.error.jersey.ThrowableExceptionMapper ThrowableExceptionMapper-toResponse - Uncaught exception thrown by REST service
javax.ws.rs.WebApplicationException
at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
(...)
Cause
An incorrect "Content-Type" (eg.text/xml) or no "Content-Type" has been defined for the call.
Resolution
The correct "Content-Type" should be indicated in the call:
1
curl -u admin:admin -X POST -d@cr.xml http://localhost:8060/rest-service/reviews-v1 -H "Content-Type: application/xml"
⚠️ Make sure to replace http://localhost:8060 with the base URL of your instance. Sometimes making cURL requests to http addresses behing SSL would also cause this 415 error
For more information over REST API please refer to the following documentation:
Was this helpful?