0

I have tried rest api in which i got reference from their document.But somehow its not working so anyone please help me out if possible.

I have tried change_password api with below code :

$url='192.168.1.72:5280/api/change_password/';
$login="key";
$password='secret';
$request=null;
$info=array("key"=> "secret",
                "args"=>array("87999","192.168.1.72:5280","test"),
            );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($info));
$output=curl_exec($ch);
curl_close($ch);
print_r($output);
exit;

I got Response like below :

{"status":"error","code":31,"message":"Command need to be run with admin priviledge."}

Document link is :https://docs.ejabberd.im/admin/api/

FYI : i am using 16.08.28 version if that can help

Ankit Doshi
  • 1,164
  • 3
  • 21
  • 43
  • Seems like you may have 2 accounts one of which is considered an Admin, and you are not using that accounts credentials in this command but it will only run if you do use the admin credentials – RiggsFolly Sep 28 '16 at 10:10
  • Yeah may be but where i have to pass admin credentials for that. actualy i have tried same code as i get reference from their document, – Ankit Doshi Sep 28 '16 at 10:12

0 Answers0