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

Format not supported error while updating confluence page through REST API

Murali July 30, 2019

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 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
AUG Leaders

Atlassian Community Events