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

Format not supported error while updating confluence page through REST API

Getting format not supported error while updating existing confluence page and creating new page. Any suggestions please? Thanks.

url -u user:pwd -X PUT -H 'Content-Type:application/json' -d '{"id":"1234","type":"page","title":"title1","space":{"key":"~ABCDE"},"body":{"storage":{"value":"<p>This is the updated text for the new page</p>","representation":"storage"}},"version":{"number":2}}' https://confluence.ab.xxxxxx.com/confluence/rest/api/content/1234

<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.52 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;fon
t-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#52
5D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: n
one;}</style> </head><body><h1>HTTP Status 415 - Unsupported Media Type</h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u>Unsupported Media Type</u><
/p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><hr c
lass="line"><h3>Apache Tomcat/8.0.52</h3></body></html>

1 answer

0 votes
Fabian Lim Community Leader Dec 24, 2021

Hi Murali,

The 415 error code is an indication that your REST call is using the incorrect 'Content-type' header for the file you are trying to upload to Jira.  This is explained in more detail in a related Fisheye KB REST API: "Error 415 Unsupported Media Type".  I realize that KB is geared for a different product than your Jira Cloud, but the concept is the same here in terms of file attachments via REST.

Instead of using the header of

'Content-Type': 'application/octet-stream'

I think instead this should be something like

'Content-Type': 'application/pdf'

for this particular pdf file.

I hope this helps.

Suggest an answer

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

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

43,945 views 33 137
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