AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
325 stars 131 forks source link

Get-JiraIssueAttachmentFile, Invoke-JiraMethod : Server responsed with NotAcceptable #459

Open mwoffenden opened 2 years ago

mwoffenden commented 2 years ago

Has anyone run into this, and is there a solution?

I've already connected to the server using an API key, and successfully accessed issues and attachments. But when I try to download an attachment I see the following.

The Powershell command is: Get-JiraIssueAttachmentFile -Credential $JiraCreds -Attachment $attachment -Path "C:\TEMP"

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

Hello,

Believe I ran into the same issue. Here is the snippet of my workaround.

foreach ($attachment in $attachments){ $path = 'C:\temp\' + $attachment.FileName Invoke-JiraMethod -URI $attachment.content -OutFile $path }