Hi,
The following curl command attaches a file to Jira ticket without a problem:
curl -D- -u jira:password -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" http://jira.mydomain.com:8080/rest/api/2/issue/SO-1/attachments
However, trying to perform the same task using PowerShell always fails:
Invoke-RestMethod -Headers $jira_headers -Uri $uri -Method POST -InFile $myfile
Tried all possible header options including:
"Authorization" = $basicAuth <--- this is not a problem (works otherwise)
'X-Atlassian-Token' = 'nocheck'
'Content-Type' = 'multipart/form-data'
and also using
[Net.ServicePointManager]::SecurityProtocol = ([Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12)
All other features via PowerShell work (download files, update Jira ticket), but for some reason File upload will not work (using PowerShell 5.1).
Any ideas would be highly appreciated.
Best regards,
Nik