Page creating erring on non-escaped HTML entities.

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
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,090 views 56 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you