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

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

Unable to display codeblock snippets when posting a page with Confluence API.


This question sums up my problem well:

And here is my code:

def _format_page(issuecomments):
    issue_body = markdown.markdown(_format_issue(issue))
issue_body = utils._replace_code(issue_body)
comment_body = _format_comments(comments)
    json = {"type""page",
"title": issue['key'] + ": " + issue['fields']['summary'],
"space": {"key": creds.confl_space},
"body": { "storage": {
"value": issue_body + comment_body,
    return json

Above is the code I'm using. Everything works and posts a page on Confluence, except the {code} ... {code} blocks appear in plain text. My goal was to convert a Markdown file to HTML and then post the snippet onto the page. The format is in storage, like the answerer said to do, so what am I doing wrong? Thank you.

Edit: Just to be clear, I am transferring Jira Issues to Confluence pages. This just formats the JSON file - it does not perform any CRUD requests.

1 answer

1 accepted

0 votes
Answer accepted
Thomas Deiler Community Leader Apr 10, 2021

Dear @Sabrina Reyes ,

I recommend to create a sample page with a code block, read the page with an API call and see how it should look like. Eventually you have to convert the read issue data to fit to the confluence json format.

So long


Thomas Deiler Community Leader May 05, 2021

Dear @Sabrina Reyes ,

was my answer useful? Then I would be happy when you click on the "green accept answer" button.

So long

Dear @Thomas Deiler

I did resolve this issue without viewing this answer, but I did the method without having looked at it, so it did help!

I realized my answer had to do with Confluence accepting pure text HTML over markup text.

Be well,


Like Thomas Deiler likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

164 views 1 7
Read article

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