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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,378
Community Members
 
Community Events
184
Community Groups

Uploading attchment using /wiki/rest/api/content/{pageid}/child/attachment results in status 415

Hi.

I am trying to set up a call to upload files to pages, but I keep hitting a snag where it tells me 415 Unsupported Media Type.

I'm trying to go by what this documentation says:
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-put

In Postman I've set up other calls, that work fine. including a GET on /wiki/rest/api/content/{pageid}/child/attachment

For the POST I have set up the header 
X-Atlassian-Token with value nocheck

 

The body is:

{
    file: "{full file path}"
    minorEdit: true
    type: image
}
I have also tested:
{
    file=@"{full file path}"
    minorEdit="true"
    type=image
}
and
{
    file=@"{full file path}"
    minorEdit="true"
    type="image"
}
Does anyone know what the correct working call would be in postman?

1 answer

1 accepted

0 votes
Answer accepted
Oday Rafeh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 27, 2023

Hi @Leon André Bergman

According to the documentation you linked you are missing the Content-Type header in your request, the Content-Type should be set to multipart/form-data for file uploads.

Try adding the following header to your request:

Content-Type: multipart/form-data

Also, make sure that the file path you are using in your request body is correct and that the file exists.

This was part of the issue.
But I only got it to work after I switched from using Raw , to form-data in the body in Postman.

Added a line with they key st to file.
Under value I browsed for the file I wanted to upload.
I had to show the Content type field under form-data, and set it to multipart/form-data for that file.

Seems this call can send multiple files, and you have to specify content type pr file. Which makes sense once you know its a multi file call, not single file.

Like Oday Rafeh likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events