I want to update an json file in confluence using the Api and Powershell
$pageId = "2226721108" # Replace with the actual page ID
$attachmentId = "2238705975" # Replace with the actual attachment ID
$proxy = "ourProxy :)"
$headers = @{
"Authorization" = "Bearer $authToken"
"X-Atlassian-Token" = "nocheck"
"Content-Type"="multipart/form-data"
}
$body =@{
"file" ="StatusTestclients\JiraUpdateTestClients\result.json"
"minorEdit"=$true
"comment"="new"
}
# Send the POST request to update the attachment file
Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Post -Body $body -Proxy $proxy
And here the error i get
Invoke-RestMethod : Der Remoteserver hat einen Fehler zurückgegeben: (500) Interner Serverfehler.
In C:\Users\WAETEI1\Desktop\toolsetprelive\StatusTestclients\JiraUpdateTestClients\UpLoadDataToConfluence.ps1:19 Zeichen:1
+ Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Post -Body $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Now is the question what im doing wrong