Uploading .xlsx file via PowerShell Invoke-RestMethod returns HTTP 415 Unsupported Media Type

Holger.Bergens
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!
March 28, 2024

Good morning everyone, 

i am trying to upload an XLSX file to one of our Confluence pages, sadly it all fails. I read serveral entries in the forums indicating it might have to do with the content type, but to no avail, it also does not seems to matter where i define the content-type (Header or when calling Invoke-RestMethod), please see my code at the end. 

If i leave the Content-Type out, i get a different error, this was recommended in one other article here.

Any help is appreciated. 

$JiraHeaderXlsx = @{
        "Accept" = "application/json"
        "Authorization" = $JiraCredentials
        "Content-Type" = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        "X-Atlassian-Token" = "nocheck"
    }
$jiraUri = "https://xxxxxxx.atlassian.net/wiki/rest/api/content/xxxxxxx/child/attachment"
$response = Invoke-RestMethod -Uri $jiraUri -Headers $JiraHeaderXlsx -Method POST -InFile $excelExportFile 





0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events