I'm using the REST API to create a program that takes pages stored locally and uploads them into Confluence. I'm having issues if the page contains picture. So far, how I do it is: 1. create an empty page, and get the pageID. Then, make a post request to attach the picture to that page id. And thirdly, I'm updating the page with the layout I want (in xml). The last part fails, if I include the <ac:image> tag, returning a 500 internal error.
<ac:image ac:height="55"><ri:attachment ri:filename="image.png"/></ac:image>
That's the tag I'm using to upload the image. The request works without it and changes the page just fine.
@Mariana Aires You need to upload the "image.png" to the page first before saving it with
<ac:image ac:height="55"><ri:attachment ri:filename="image.png"/></ac:image>
I upload the picture to the page first, and it uploads it successfully under "attachments", and only then try to insert the image into the page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mariana Aires Can you share the exception in your server log? And what Confluence version have you been using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay after checking the logs and doing some testing, I figured out the problem was I wasnt escaping the quotes correctly in the height and the filename. I was only escaping the quotes (as " -> \") but its also necessary to escape the backslash (so \" -> \\\"), in Java. Thank you a lot for the help and I hope my solution might solve the problem for anyone having the same issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.