I'm having trouble adding an attachment with the Add-JiraIssueAttachment cmdlet from JiraPS, but this seems to work from a linux machine
curl --location --request POST 'https://company.atlassian.net/rest/api/3/issue/TEST-1234/attachments' -u 'Myemail@company.com:THEAPIKEYTHATIUSE' -H 'X-Atlassian-Token: no-check' --form 'file=@"c:\temp\csvwithstuff.csv"'
so if I go native api in my script, how to I migrate this curl command to invoke-restmethod? Here's what I have but it's not working
$Token = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('Myemail@company.com:THEAPIKEYTHATIUSE'))
$auth = @{
'authorization' = "Basic $Token"
'X-Atlassian-Token' = 'no-check'
}
$file = "c:\temp\csvwithstuff.csv"
$enc = [System.Text.Encoding]::GetEncoding("iso-8859-1")
$boundary = [System.Guid]::NewGuid().ToString()
$readFile = [System.IO.File]::ReadAllBytes($file)
$fileEnc = $enc.GetString($readFile)
$url = "https://company.atlassian.net/rest/api/3/issue/TEST-1234/attachments"
Invoke-restmethod -Uri $url -Headers $auth -Method POST -ContentType "multipart/form-data; boundary=`"$boundary`"" -InFile $filePath -Verbose But i'm getting an error message about
Invoke-restmethod : Cannot find drive. A drive with the name <contents of the file>
What am I doing wrong?