Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

HTTP method is not allowed for the requested resource

Using the REST API resources, http://localhost:8095/crowd/rest/usermanagement/latest/user?username=USERNAME  we are able to receive the XML response successfully. The <href> links for <attributes> work without any HTTP error, but not for <password> it produces an HTTP 405 Error code having description :The specified HTTP method is not allowed for the requested resource.

We also tried the http://localhost:8095/crowd/rest/usermanagement/latest/authentication?username=USERNAME but got same error.

How to access the <password> for authentication purposes from XML response ?

2 answers

1 accepted

1 vote
Answer accepted
rrudnicki Atlassian Team Sep 11, 2014

Hi Karthikayan, 

The code 405 means that the method used is incorrect. So, maybe, you might be using GET instead of POST, and the password attribute just works with POST method, as you can see in this link in the session User Authentication  Resource. 

Given that, you can test the command bellow for we see if you can get the return as you expect.


curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u appname:apppassword -d '{"value":"password"}' http://localhost:8095/crowd/rest/usermanagement/1/authentication?username=USERNAME

Please let me know if it worked. 



Renato Rudnicki


Thank you Renato ,

This command worked perfectly on terminal. But produced HTTP 400 error for Content- type :XML.
Also , How can this POST request be embed with PHP-curl script to authenticate a user ?

I am attaching the code snippet for review.

Looking forward to your reply.


 $xml = "&lt;?xml version='1.0' encoding='UTF-8'?&gt;";
 $xml .= "&lt;request&gt;";

 foreach ($_POST as $key =&gt; $val) {
 $xml .= "&lt;".$key."&gt;". $val ."&lt;/".$key."&gt;";
 $xml .= "&lt;username&gt;USERNAME&lt;/username&gt;";
 $xml .= "&lt;password&gt;PASSWORD&lt;/password&gt;";
 $xml .= "&lt;/request&gt;"; 

 echo "&lt;br/&gt;" . $xml . "&lt;br/&gt;&lt;br/&gt;";

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, 'http://localhost:8095/crowd/rest/usermanagement/latest/authentication?username=USERNAME');
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
 curl_setopt($ch, CURLOPT_HEADER, 1);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/xml'));
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

 $output = curl_exec($ch);

 echo '&lt;pre&gt;';
 echo htmlspecialchars(print_r($output, true));
 echo '&lt;/pre&gt;'; 
rrudnicki Atlassian Team Sep 14, 2014

You’re welcome Karthikayan, I’m glad that I could help you. Let me try again :) A good way for you do your own troubleshoot about http errors is try to understand what means the HTTP codes. In this case, 400 error means problem with the syntax. You can get a full list in this link: . I’m not a developer, but having a look in your php script, I believe that you are in the right way about the code (you just need to find where is the syntax error in your script). However, I’m afraid my PHP skills aren’t enough to help you about the POST request be embed in the script :( but let’s see if someone more can help us with it. If there’s anyone thing that I can do for you, feel free to ask :) Chers, Renato Rudnicki

Thank you Renato , I figured solution for this :)

rrudnicki Atlassian Team Sep 16, 2014

Hi karthikayan, I'm glad to hear it :) If you don't mind, could you share the solution here ? Maybe it can be useful to another person in the future. All the best, Renato Rudnicki

Love it when people ask for help and then leave with the comment "I figured solution for this :)". Somehow selfish.

Like # people like this

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events