Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Invoke-JiraMethod : Server responsed with NotAcceptable

Michael Woffenden
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2022

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]

2 answers

0 votes
Paul Krueger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 1, 2022

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
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 28, 2022

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events