Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,043
Community Members
 
Community Events
168
Community Groups

Query specific JIRA fields using PowerShell Invoke-RestMethod with &fields

I am successfully using PowerShell Invoke-RestMethod to run jql queries, but  when i add a fields list, &fields, or &startAt - the ampersand & does not seem to be getting parsed correctly

  

This works fine:

$Headers = @{ Authorization = $basicAuthValue }

$Body = @{ jql = "status=Closed" }
$Params = @{
Uri = "https://me.com/rest/api/2/search"
Method = "GET"
Headers = $Headers
Body = $Body
}
$response = Invoke-RestMethod @Params
$response | ConvertTo-Json

 

But if the jql contains a fields list:

$Body = @{ jql = "status=Closed&fields=project" }

 

The remote server returned an error: (400) Bad Request.

 

If I capture the error:

{Field 'fields' does not exist or you do not have permission to view it.}

 

 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

181 views 1 6
Read article

Atlassian Community Events