Page creating erring on non-escaped HTML entities.

frogstarr78 September 8, 2017

I have a bit of a problem uploading content using the API. I finally figured out that it throws errors when the content hasn't been escaped with HTML entities, however, now that I'm escaping the content, it displays the html entities in the content (also in part because I'm wrapping this content in a code macro which displays the content in a CDATA text element). 

CONTENT="grep this /in/file && echo y"
CONTENT="grep this /in/file \&\& echo y"
CONTENT="grep this /in/file && echo y"

curl --netrc
-H 'Content-Type: application/json' -d'{"type":"page","title":"new page", "ancestors":[{"id":456}], "space":{"key":"TST"},"body":{"storage":{"value":"<p>'$CONTENT'</p>","representation":"storage"}}}' https://confluence/wiki/rest/api/content/

The first CONTENT variable causes the api call to fail. The second and third work, however, they display \& and &amp; on the page (in the code macro content).

I understand this is a very small and specific issue, but can someone offer some suggestions for how I need to change the request so it displays the unescaped html entities on the page?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events