I have created a chatroom from openfire know i have to delete a chatroom from openfire.for this i have using REST api plugin with the help of curl. I have tried below code but it is not working for this i have also refer the docs from REST api plugin of openfire but i am not getting where i am going wrong please guide me to resolve this issue.
Code using REST API plugin to delete a chatroom
<?php
$url1 = "http://ipaddress:9090/plugins/restapi/v1/chatrooms";
$data1 = "<chatroom>
<roomname>test</roomname>
<servicename>conference</servicename>
</chatroom>";
$username1 = "Adminconsoleusername";
$password1 = "Adminconsolepassword";
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL, $url1);
curl_setopt($ch1, CURLOPT_PORT, "9090");
curl_setopt($ch1, CURLOPT_POST, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data1);
curl_setopt($ch1, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'Authorization: Basic ' . base64_encode("$username1:$password1")));
$code1 = curl_getinfo($ch1, CURLINFO_HTTP_CODE);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
//echo $code1;
$res1 = curl_exec($ch1);
//echo "code " . $code;
echo $res1;
print_r($res1);
curl_close($ch1);
I have also refer the REST api doc https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#examples-20
Please help me, Thanks in Advance.
The URL should also contain the chat room you like to delete. e.g $url1 = "http://ipaddress:9090/plugins/restapi/v1/chatrooms/testroom";