Forums

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

500 error when trying to upload attachment to Confluence server using REST API

David Clarkson
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!
August 28, 2021

Hello, I've been wrestling with this and can't figure out the cause.  I'm trying to upload an attachment to Confluence using the REST API with the details below.  I'm getting 500 errors every time.  Unfortunately I don't have access to the Confluence log.  Is there anything obvious I'm missing here, using the example below?  I've confirmed that the file referenced does exist in the /tmp directory on the server. 

Endpoint:

https://myServer/confluence/rest/api/content/209128247/child/attachment

Request body:

fileName=@/tmp/f3a6349b1b0ebc94228a11b39b4bcbb5.png

Added header:

{X-Atlassian-Token=no-check}

Response:

[ERROR CODE: 500 ] Method failed: (/confluence/rest/api/content/209128247/child/attachment) with code: 500

1 answer

0 votes
Carlos Garcia Navarro
Community Champion
August 28, 2021

Hi @David Clarkson ,

The error 500 is a generic HTTP error that indicates that something has gone wrong on the server side. I'd check with the server admin person, as those logs may provide more specific information.

I was wondering if you could try a different way to test it. This page describes a method to upload attachments and shows a shell script that uses the REST API (also user/password authentication).

https://confluence.atlassian.com/confkb/using-the-confluence-rest-api-to-upload-an-attachment-to-one-or-more-pages-1014274390.html

Other articles that may help troubleshoot:

https://confluence.atlassian.com/confkb/getting-http-error-code-500-for-all-rest-requests-252347532.html

https://www.lifewire.com/500-internal-server-error-explained-2622938

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events