Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

update via REST returns 415

balvey27 March 31, 2022

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

 

3 answers

1 accepted

0 votes
Answer accepted
balvey27 April 4, 2022

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

0 votes
chilyanin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2022

@balvey27 are your python put requests works fine now ?

0 votes
WW
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.
April 1, 2022

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"

balvey27 April 1, 2022

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. 

WW
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.
April 4, 2022

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.

balvey27 April 4, 2022

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. 

WW
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.
April 4, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events