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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

372 views 20 10
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