2016-11-26 147 views
2

我可以用简单的内容成功创建和更新Confluence wiki页面。但是,如果尝试使用多个字符串进行更新,则会出现错误。Confluence Rest文件更新页面

我有一个在Markdown格式化的git仓库中的文档集合。由于遗留需求,我使用pandoc将它们转换为单词以在文档系统中进行部署。我们正在转向Confluence,所以我想将更新部署为wiki页面。

我有页ID,版本和标题

echo "update page ${title} - ${pagid}/${pagver}" 
content=$(pandoc -t HTML ${file}) 

json="{" 
json+='"id":"'${pagid}'","title":"'${title}'","type":"page",' 
json+='"space":{"key":"'${SPACE}'"},' 
json+='"version":{"number":"'${pagver}'"},' 
json+='"body":{"storage":{"value":"'${content}'","representation":"storage"}}' 
json+="}" 

${curlcmd} -n -X PUT -H 'Content-Type: application/json' --data-raw "${json}" ${apilb}/content/${pagid} 2>/dev/null 

如果我设置为<p>this is test content</p>它工作正常含量。但是复杂的HTML得到这个错误:

{"statusCode":500,"message":"org.codehaus.jackson.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: [email protected]; line: 1, column: 157]"} 

有没有更好的方式来发送文件的输出更新汇合维基页面?

回答

相关问题