Push XHTML to Confluence space with rest API

Tobias
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2020

Dear all,

 

I want to pull confluence content from one instance and push it to another instance. Using the "normal" migration does not work and already has been deeply checked with atlassian support, hence I wanted to use the REST API to migrate at least the content of the pages.

But here I am running into the next problem: I can perform a GET without issue and also I can do a POST, but only with simple content, such as plain text or simple XHTML.

 

But when I take the content from the old page, it fails. I assume, that this is due to some content which the API cannot perfom?! I don't know, but maybe someone of you knows.

 

PS: As representation I receive "storage" in the GET request, so I use this for the POST as well. Also tried with "wiki" as representation, but does not work as well.

 

$postParams = @"
{
"type":"page",
"status" "current",
"title":"hereisthetitlename",
"space":{"key":"hereisthekey"},
"body":{
"storage":{
"value":"
<ac:layout><ac:layout-section ac:type=\"two_right_sidebar\"><ac:layout-cell>
<p>hereissomesamplecontent</p>
<ul>
<li>hereissomesamplecontent</li>
<li>hereissomesamplecontent</li>
<li>hereissomesamplecontent</li>
<li>hereissomesamplecontent</li>
</ul>
<p>hereissomesamplecontent<ac:link>
<ri:attachment ri:filename=\"thisisafile.msg\" />
<ac:plain-text-link-body><![CDATA[thisisthefiletitle.msg]]></ac:plain-text-link-body>
</ac:link></p><p><br /></p>
<p>hereissomesamplecontent</p>
<p>hereissomesamplecontent \\\\<a href=\thisisafilepath</p>
<p>hereissomesamplecontent</p>
<p><ac:image ac:height=\"247\"><ri:attachment ri:filename=\"thisisanimage.png\" /></ac:image></p>
<p><br /></p>
<p>hereissomesamplecontent: <ac:link><ri:page ri:content-title=\"linkname\" /></ac:link></p>
<p><br /></p>
<p>hereissomesamplecontent</p>
<p><ac:image ac:height=\"250\"><ri:attachment ri:filename=\"thisisanimage.png\" /></ac:image></p>
<p><br /></p></ac:layout-cell><ac:layout-cell>
<p><ac:image ac:align=\"center\" ac:thumbnail=\"true\"><ri:attachment ri:filename=\"thisisanimage.png\" /></ac:image></p>
</ac:layout-cell></ac:layout-section></ac:layout>",
"representation":"storage"}}
}
"@

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events