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,298,560
Community Members
 
Community Events
165
Community Groups

update via REST returns 415

I've gotten this to work in the past but for some reason i'm no longer able to update our wiki via API, i'm continually getting a 415 response. 

I'm using python3 and I've tried via requests package and the atlassian Confluence methods. Both return 415 regardless if I supply content-type in my header or not. Actually using  '''from atlassian import Confluence''' I'm not even sure how to supply content-type, the docs are not that good and I'm assuming it defaults to application/json. 

The GET calls return with no problem, it's just the PUT method that is giving me issues.

 

raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 415 Client Error:  for url: https://confluence.servers.xxxxx/rest/api/content/123455667

 

2 answers

1 accepted

0 votes
Answer accepted

was an internal problem with a server move and path names changing

The problem would be easier to diagnose if we could see exactly what you're sending.

I'm not sure what '''from atlassian import Confluence''' is, but Content-Type can be supplied as a header like any other header.

In python, it'd be something like:

response=requests.put(
"https://www.myconfluence.com/",
headers={"Content-Type":"application/json"},
data ={'key':'value'}
)

Is the problem happening for every page you try with different content? It's possible you have some weird character(s) in the Json you're trying to PUT.

You can also see REST API: "Error 415 Unsupported Media Type"

sorry, it's the atlassian-python-api package for python. it's building the requests calls internally, and it doesn't look like there's an option to pass custom headers, but it does appear to set the content-type to application/json 

 

I've tried even sending a simple <p>sometext</p> string for the data and it returns 415. I've tried multiple pages as well. 

 

and I've built my own requests calls but they have the same results. I can pull data fine though, page_exists, and doing a GET on basic information works as it should.

 

beginning to wonder if it's a bug in this version. we're on 7.3.4. It's been a while since I successfully updated a page, and I'm not sure if it was an earlier version. 

Are you able to do any other PUT/POST/DELETE actions?

In that link I posted in my answer, it also says:

Sometimes making cURL requests to http addresses behing SSL would also cause this 415 error

I think it's supposed to say "behind" (or maybe "being"?).

I don't really understand what that means, though, either way it's spelled. When doing a google search on error 415 SSL, you'll see some results that say that the error could be related to something with an SSL certificate like this page. No idea how to fix any of that, but it might help lead you to a fix.

Thank you for the response, I have found the issue and it was nothing to do with content. Our wiki is ran internally and they moved to a new server, the redirect they had in place got dropped and post/put actions were not being handled by it properly. 

 

That said, my 415 is now resolved, but now I'm getting 400 errors and think it's due to size limitations of the amount of data i'm trying to update it with. That or there is a bad character in the data. 

I'm glad you were able to find the issue. :)

Suggest an answer

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

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

208 views 1 4
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