Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Which HTML tags are valid to PUT using Confluence API?

I am trying to update Confluence pages using the REST API. Specifically, I am using  /rest/api/content/{id} with a PUT request. When I try to update the page with just text, it always works so I know I am doing the request properly. 

However, when I try to update the page with content that contains links (i.e. <a ....> .... </a>) or other HTML elements, it gives me a 500 error and doesn't update. Instead of using trial and error with every tag and parameter, is there a page of documentation specifying what is allowed to be sent through the REST API and what is not?

Ideally, one solution I thought of would be to wrap the content I'm pushing in an HTML macro. But when I wrap the content it displays on the page literally as "{html}".

Has anyone been able to update Confluence pages using the REST API that involve moderately complicated HTML?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Joe Clark Atlassian Team Feb 01, 2016

There's a reference doc for Confluence's valid markup here: https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html

The key thing to note is that you have to store XHTML, not HTML (so opening tags with no closing tags which are valid in the HTML5 spec won't work in Confluence).  Additionally, there is an additional layer of filtering that goes on when content is saved, and some attribute values may be stripped out. I don't think we have any docs on the specifics of that.

Finally, if you are submitting the updated content via REST and JSON, I think you might need to HTML-escape the content in the body string.

TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you