我的目標是使用所提供的REST API在合流wiki中創建一個包含表格的頁面,該頁面創建後,可以使用WYSIWYG編輯器輕鬆編輯。使用Confluence REST API發佈生成的html表(PHP)而無需獲取http 400狀態代碼?
我已經分解了文本,並將其放入不同的類別中放入一個數組數組中,然後生成一個html表(字符串),這很好用。
然而張貼這原始的HTML表($ HTMLTABLE)爲內容的REST API
$data = array("type" => "page", "title" => someTitle,
"space" => array("key" => "$uploadSpace"),
"body" => array("storage" => array("value" => "$htmlTable", "representation" => "storage")));
返回一個400的StatusCode錯誤。很顯然,因爲使用htmlspecialchars
將輸入的字符串編碼爲html,輸入沒有正確地轉義,但是如何創建一個結構化輸入來轉換爲html表格呢?
我試圖通過我的HTML表格與呈現HTML輸入到表中進行查看合流宏:
$data = array("type" => "page", "title" => someTitle,
"space" => array("key" => "$uploadSpace"),
"body" => array("storage" => array("value" => "<ac:structured-macro ac:name=\"html\"><ac:plain-text-body><![CDATA[$htmlTable]]></ac:plain-text-body></ac:structured-macro>", "representation" => "storage")));
這使得在頁面上我的HTML表格,但是這未能在易於編輯所見即所得的要求作爲wiki的用戶之後會看到宏中包含的HTML代碼。
非常感謝您提前。