Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Ed Sullivan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2021

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
atlassian, team ’25 europe, early bird extension, conference discount, barcelona, hybrid event, AI teamwork, early bird pass, digital access, collaboration conference, atlassian events, register now, developer conference

1 week left to save on your Team '25 Europe pass

Still thinking about joining us for Team '25 Europe? Early bird has been extended for just one week! Now’s the time to lock in your lowest rate. Use code TEU25COMM-20 to save 20% at checkout. Hurry, this only lasts for 1 more week.

Learn more
AUG Leaders

Atlassian Community Events