Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-4875

REST API calls using MIME-type text/xml content are failing

    • Icon: Bug Bug
    • Resolution: Answered
    • Icon: Low Low
    • None
    • None
    • None
    • None

      Summary

      REST API calls using MIME-type text/xml content are failing

      Environment

      Crowd 2.10

      Steps to Reproduce

      1. 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.

            [CWD-4875] REST API calls using MIME-type text/xml content are failing

              Unassigned Unassigned
              dponzio Daniel Ponzio
              Affected customers:
              1 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: