I want to write API's in confluence
but I am getting confused where to write it.
I am using ubuntu 16.04 and my confluence is installed in /opt/atlassian
also there is one more folder in /var/atlassian
now I am writing api's using php which are located in /var/www/html/confluence_api
<?php
$data = {
"type":"page",
"title":"My Test Page",
"space":{"key":"TST"},
"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}
};
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost:8090/rest/api/content/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "*****" . ":" . "*****");
$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
print_r($result);
?>
and I am using POST method for calling the API but I am getting 404 http_code in return
GET method is working fine but not POST
please answer me ASAP