Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Push XHTML to Confluence space with rest API

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
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

75 views 0 3
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