Forums

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

Errors when attempting to fetch project using Powershell

Caleb Ellenburg
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!
January 20, 2022

I am currently trying to fetch a list of all issues/tasks in a project using Powershell. The problem I'm running into is I receive the following error every time:

 

Invoke-JiraMethod : The value 'project name' does not exist for the field 'project'.

 

I've confirmed the account being used to access (my own) has the right permissions - I'm a Site Admin, as well as the creator and admin for this specific project. My code is below:

 

$user = [System.Text.Encoding]::UTF8.GetBytes("admin account@domain.com:jira API token"


$headers = @{Authorization = "Basic" + [System.Convert]::ToBase64String($user)}

 Invoke-RestMethod -Uri "https://companyname.atlassian.net/rest/api/2/jira/core/projects/" -Method GET

$weekly = Get-JiraIssue -Query 'project = "project name"'

 

Any thoughts on what I'm missing?

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Champion
January 25, 2022

Hi @Caleb Ellenburg ,

I think you are using a wrong rest api. Try using the following Rest https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get that allows you to retrieve all issue based on a jql.

Hope this helps,

Fabio

Caleb Ellenburg
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!
January 26, 2022

Hi @Fabio Racobaldo _Herzum_ 

 

I tried using the rest api v3 but still receive the same error message. Any other ideas?

 

Thanks!

Fabio Racobaldo _Herzum_
Community Champion
January 26, 2022

Please, verify the encoding of your JQL. Special characters and/or whitespace should be encoded in order to work correctly.

Ciao,

Fabio

Suggest an answer

Log in or Sign up to answer