Can't download the attachment from a Jira ticket with Powershell

Jason Chan November 23, 2022

Hi,

I would like to download the attachment from a Jira ticket using the command

Get-JiraIssueAttachment -issue $Request | get-jiraissueattachmentfile -path $path"

but I got the error 

--------------------------------------------------------

Invoke-JiraMethod : Server responsed with NotAcceptable
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.14.6\JiraPS.psm1:1886 char:23
+ $result = Invoke-JiraMethod @iwParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
+ FullyQualifiedErrorId : InvalidResponse.Status406,Invoke-JiraMethod

--------------------------------------------------------

I know it is error 406 that something to do with the proxy/firewall. So, I'd like to get around by using: 

-------------------------------------------------------

Invoke-JiraMethod -Uri (Get-JiraIssueAttachment -Issue $request).content[0] -OutFile $path.$request.txt

------------------------------------------------------

but then I got another error 

------------------------------------------------------

Invoke-JiraMethod : Cannot process argument transformation on parameter 'URI'. Cannot convert value "h" to type "System.Uri". Error: "Invalid cast from
'System.Char' to 'System.Uri'."
At line:1 char:24
+ ... Method -Uri (Get-JiraIssueAttachment -Issue $request).content[0] -Out ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-JiraMethod], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Invoke-JiraMethod

------------------------------------------------------

The attachment is a simple CSV file, so I don't know what is going on. So strange that if the attachment is a TXT file, sometimes it can get through.

Please help.

 

Regards

Jason

2 answers

0 votes
cbaker
Contributor
October 16, 2023
0 votes
cbaker
Contributor
October 5, 2023

Did you have any luck with this mate?

Suggest an answer

Log in or Sign up to answer