I'm trying to upload a zip file to a Confluence page with a axios.post and I'm getting "Unsupported Media Type" error. I'm following the instructions from Atlassian Development REST API documentation. Does anyone know why I'm having this issue? Any help is appreciated, thanks! This is my code:
axios.post('http://example.com/rest/api/content/1234/child/attachment
', {
file: "filepath/namefile.zip",
comment: "comment to file"
}, {
headers: {
"X-Atlassian-Token": "no-check",
"Content-Type": "application/zip",
},
auth: { username: "user@user", password: "passwordToken" }
})
.then(res => {
console.log(res)
})
.catch(error => {
console.error(error)
})
Hi @dtrotta
Welcome to the community!
See if this workaround fixes your issue: https://confluence.atlassian.com/fishkb/rest-api-error-415-unsupported-media-type-313468261.html
Regards
Hi @Fabian Lim
I tried with:
"Content-Type: application/zip"
and got the same error, then I tried with:
'Content-Type': 'multipart/form-data'
data: {
statusCode: 500,
message: 'java.lang.RuntimeException: org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found'
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.