Create
cancel
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

Can't display image in page properties macro when updated via API

We've been using Confluence API to upload images in a specific section of our wiki pages, however these pictures are now not displaying correctly inside the macro (a page properties one, with a specific ID).

The API request goes through and succeeds; however in the attachments section we cannot see the preview of such images, we can only download them. The downloaded pictures correspond perfectly with what we expect to see in the page. 

However, they seem not be loaded correctly in the page:

https://ibb.co/t21DLS6

If we try to upload the same picture "manually" inside the macro and publish the page, it all works fine. Whenever we try to update it however, it will go back to the "failed to load mode". 
Other pictures that we uploaded manually once can be previewed just fine.

 

Some specifications of the POST API call we perform:

```

headers = {"X-Atlassian-Token": "no-check"}
"minorEdit": True,
"type": "attachment"
"comment": timestamp
"url": https://xxx.atlassian.net/wiki/rest/api/content/<pageID>/child/attachment/<attachmentID>/data

"file": @file
```

We believe the problem is the `mediaType` the API recognizes the PNG file to be, which is oddly: `application/octet-stream`, as we see when we issue a GET call to get the list of attachments. However `mediaTypeDescription` is correctly `PNG Image`.
We couldn't find any way to force `mediaTyppe` to be `image/PNG` in the API documentation.

Any help would be appreciated, thanks.

1 answer

0 votes
Diego Atlassian Team Feb 24, 2021

Hello there @Alvise Z. !

Going straight to the point, I tried to replicate the behavior but was unable to.

Even though our community is filled with capable members, I firmly believe that your situation will be best served by our sister, the Developer Community!

Maybe take a look and share your situation with our experts over there:

Let us hear from you!

Hi Diego, will do.

Thank you for the suggestion.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
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,683 views 7 31
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