Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

how to attach multiple images and files to create page in confluence rest api

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

1 answer

0 votes
Thomas Deiler Community Leader Oct 17, 2018

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.

Thomas Deiler Community Leader Jun 07, 2021

Dear @antony terrence ,

you are right. Please open a suggestion at https://jira.atlassian.com for your requested feature.

So long

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Introducing External Collaboration for Confluence

We’re excited to introduce external collaboration for Confluence, now available in early access. It is available to preview for Confluence Cloud Premium and Enterprise customers. (If you're not on ...

208 views 0 8
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