The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events