1

I need to create a confluence page via the REST API. Creating a simple page is working, however if I try to add content to an existing HTML page I get http_response 400 (bad request).

Code snippet:

confluence_page_content = File.open("local_html_report", "r").read
json_data = {
  "body" => {
    "storage" => {
    "representation" => "storage",
    "value" => "#{confluence_page_content}"
    }
  },
  "space" => {
   "key" => "#{test_parameters["confluence_space"]}"
  },
  "title" => "TestPageFromChef",
  "type" => "page"
}.to_json 

1 Answer 1

6

Hy, solved it :)

Code snippet:

confluence_page_content = "<ac:structured-macro ac:name=\"html\">
  <ac:plain-text-body><![CDATA[
  #{confluence_page_content}
  ]]></ac:plain-text-body>
  </ac:structured-macro>
  "
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.