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

Newline character in HTML causes `UnsupportedOperationException` when updating a page


Steps to reproduce - 

def update_with_attachment(page,  space, version):
    data = {
        "type": "page",
        "title": title,
        "id": page,
        "space": {"key": space},
        "body": {
           "storage": {
             "value": '<ac:image><ri:attachment ri:filename="image.png">\n</ri:attachment></ac:image>',
             "representation": "storage"
        "version": {"number": version}
response = requests.put(url, json=data, auth=auth)


Expected result - 

A 200 Response


Actual result - 

com.atlassian.confluence.api.service.exceptions.InternalServerException: java.lang.RuntimeException: java.lang.UnsupportedOperationException



Remove the newline character from 

<ri:attachment ri:filename="image.png">\n</ri:attachment>


1 answer

0 votes
Diego Atlassian Team Mar 18, 2021

Hello there @Andrew Marshall!

As I understand, you need to create a new line after the attachment you created. I also believe that you are trying to do so via REST, is that correct?

The way you added the newline character shows us that the \n was added as if it was inside the attachment structure, not after it.

You can try adding the \n after the attachment structure. You can check more details about REST API here:

Confluence Cloud Developer - Content - attachments

Let us hear from you!

Suggest an answer

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

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,546 views 7 29
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