Has anyone run into this, and is there a solution?
We're using JiraPS.
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.
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]
https://atlassianps.org/docs/JiraPS/commands/Get-JiraIssueAttachmentFile/
I don't think you need the credentials flag if you've already established the New-JiraSession. Also, you're not specifying an issue to pull the attachment from. Here's the example from the documentation above (it pulls all .png attachments from the issue and saves them in the temp folder):
Get-JiraIssue TEST-002 |
Get-JiraIssueAttachment -FileName "*.png" |
Get-JiraIssueAttachmentFile -Path "c:\temp
I'm not sure what JiraPS is, but it is doing a couple of things you need to work through.
First, the bit I'm slightly uncertain of - I think it's giving you an error message which is its own rendering of the actual error it got back from Jira. Although it wasn't actually Jira, it was the Tomcat or one of the network services your request went through. "Not Acceptable" is usually an HTTP error, rather than an application error. Later on, the message includes "Status406", so although I'm not 100% sure, I'm pretty sure your code is getting an HTTP error 406.
Second, an HTTP 406 error happens when the request you make a request that has content negotiation requests that the server can not meet.
So, if that guess is correct, the problem is that JiraPS is sending a broken request to Jira when you code it to ask for an attachment.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406 for a bit more on that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.