Can not download a file using JiraPS (ATLASSIANPS)

cbaker
Contributor
October 16, 2023

Hi :-) ,
Has anyone manged to download a file from a Jira issue using JirsPS- note I'm trying to do this in a JSM project?

This is the command I am running (I have got an authenticated session) :
Get-JiraIssue SD-35306 | Get-JiraIssueAttachment -FileName "*.txt" | Get-JiraIssueAttachmentFile -Path "C:\Scripts\AD_User_Updates\Working folder"

This is the result:

PS C:\Scripts\AD_User_Updates\Working folder> Get-JiraIssue SD-35306 | Get-JiraIssueAttachment -FileName "*.txt" | Get-JiraIssueAttachmentFile -Path "C:\Scripts\AD_User_Updates\Working folder"
Invoke-JiraMethod : Server responsed with NotAcceptable
At C:\Users\bakerc\Documents\WindowsPowerShell\Modules\JiraPS\2.14.7\JiraPS.psm1:1886 char:23
+             $result = Invoke-JiraMethod @iwParameters
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
    + FullyQualifiedErrorId : InvalidResponse.Status406,Invoke-JiraMethod
 
True

PS C:\Scripts\AD_User_Updates\Working folder> 
Any ideas on what I need to do to get it to work? (

1 answer

1 accepted

0 votes
Answer accepted
cbaker
Contributor
October 16, 2023

Ok for those who are interested this is how you make it work - always the way after you post something you work it out :-)

 

$attachments = Get-JiraIssue SD-35306 | Get-JiraIssueAttachment -FileName "*.txt" 
foreach ($attachment in $attachments)
{
$path = 'C:\Scripts\AD_User_Updates\Working folder\' + $attachment.FileName
Invoke-JiraMethod -URI $attachment.content -OutFile $path
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events