I am writing rest api in confluence to create page
and also want to attach images in it
but image is not showing in page
my php curl is as below
public function create_content(){
$qbody = file_get_contents("php://input");
$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, $qbody);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "admin" . ":" . "Abc@1234");
$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 sending request in raw
i am sending image using base64 format and my html tags also not working
Dear @Vidya Shevale,
afaik you cannot attach files/images to a page that does not exist or in other words, first create a page and then attach the files.
And you do not need to send the files base64 encoded - this will do curl for you.
Hope that helps. If not, please give me more details of what you exactly do.
So long
Thomas
@Thomas Deiler The fact that you are creating a new page, shouldn't it allow you to upload attachments with along with the new page data? Won't it be much better than having to make two calls to complete a page creation? Images are essentially page data, For the image macro to work, the attachments should be present. Until the attachments are uploaded, the new page is incomplete. So Atlassian should have allowed users to upload attachments along with the page data. But it's unfortunate we have to do two calls to complete a page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @antony terrence ,
you are right. Please open a suggestion at https://jira.atlassian.com for your requested feature.
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.