How to create a page with base64 embedded image via REST API?

krivonos January 2, 2022

Hi all,

I use REST API to create pages in my Confluence server. It works fine for simple text, but if HTML text posted to the server contains base64 image, the POST operation finished well, but created page doesn't contain the image code. It is simply cut. Of course, created page doesn't show the image.

In the source it is like that:

<img src="data&colon;image/png;base64,iVBORw0KGg (many symbols here)=" />

Please, help.

1 answer

1 accepted

1 vote
Answer accepted
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 4, 2022

Yeah, that's not going to work.

It's a nice idea and I'd like it to work, but images need to be separate to content. Maybe upload as an attachment, then add the image to point to the attachment.

krivonos January 6, 2022

Yes, I did it. Now I have 3-steps page creation: 1) create a simple page just in order to know its ID; 2) upload images as attachments with already known page ID; 3) update page with its full content and references to attachments.

It isn't very nice and I would like to create a page with images in just one step, but I don't have another solution.

Anyway I have this workaround, it is better than nothing.

Aresky Bandera
Contributor
February 20, 2024

Hey, was this approach using base 64 images? 
I'm trying to get that done but the only solution I can see is to parse it to an actual image and then upload it as an attachment. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events