It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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;'; 

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 :)

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
Community showcase
Published in Confluence

What's New in Confluence Cloud – November 2019 Edition

Hey community! This month we’re excited to share brand new features to help you make your mark on Confluence. If you haven’t already, check out our updates from October and September too! Expre...

29,101 views 29 56
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you