-
Bug
-
Resolution: Answered
-
Low
-
None
-
None
-
None
-
None
-
Severity 3 - Minor
-
Summary
REST API calls using MIME-type text/xml content are failing
Environment
Crowd 2.10
Steps to Reproduce
- Make a POST call such as the following on your Crowd instance:
curl --header "Content-Type: text/xml" --header "Authorization: Basic Y3Jvd2Q6Y3Jvd2Q=" -X POST -d '<?xml version="1.0" encoding="UTF-8"?><password><value>crowd</value></password>' "http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=admin"
Expected Results
Results are returned in formatted XML. For example, when I run the CURL command above on my Crowd 2.7.2 instance it works and returns the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><user expand="attributes" name="admin"><link href="http://localhost:8272/crowd/rest/usermanagement/1/user?username=admin" rel="self"/><first-name>admin</first-name><last-name>admin</last-name><display-name>admin admin</display-name><email>admin@admin.com</email><password><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/password?username=admin" rel="edit"/></password><key>32769:a3ca9c26-137f-4689-8e9a-1be9dd8158b9</key><active>true</active><attributes><link href="http://localhost:8272/crowd/rest/usermanagement/1/user/attribute?username=admin" rel="self"/></attributes></user>
Actual Results
HTML error is returned:
<html><head><title>Apache Tomcat/7.0.69 - Error report</title><style><!--H1 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY \{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B \{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P \{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A \{color : black;}A.name \{color : black;}HR \{color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.69</h3></body></html>
Workaround
Change the command to use application/xml.
dponzio it seems that there is a difference in this endpoint behaviour. Indeed in previous versions of Crowd text/xml mime type was accepted and with Crowd 2.10.1 release we've changed it to application/xml as it is a mime type that other Atlassian products are using. In our new REST API documentation (introduced with 2.10.1 release) we are not explicitly saying what mime type is accepted but in previous one there was an example with application/xml
We would rather not change the behaviour again to accept {{text/xml }}and instead we would improve our current documentation.
Was customer able to resolve the problem in his custom integration?