Rest API Returns no projects even though I am site admin

ericreiner
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!
November 15, 2019

I am a site admin and trying to use the REST API to retrieve a list of projects.  In the UI I am able to see and manipulate all projects/items.  The REST API always returns 0 projects. 

            var jira = Jira.CreateRestClient("[App URL]", "[username]", "[password]", new JiraRestClientSettings() { EnableRequestTrace = true });
            var yyy=jira.Projects.GetProjectsAsync().Result.ToList();
            var response1 = jira.RestClient.ExecuteRequestAsync(RestSharp.Method.GET, $"/rest/api/3/project/search").Result;
            var response2 = jira.RestClient.ExecuteRequestAsync(RestSharp.Method.GET, $"rest/api/2/project?expand=id,title&recent=10&includeArchived=true&browseArchive=true").Result;

I have tried the 3 ways above and all return successful but have no projects listed.  I assume this is a permission issue but can not find what permission I might be missing.  Since I am a Site Admin, I should have everything.

 

2 answers

0 votes
Warren
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.
November 18, 2019

Hi @ericreiner 

As @Hana Kučerová said, what code is returned? Is it an error code or success code?

Try a simple issue call like /rest/api/3/search or even /rest/api/3/search?jql=key=ABC-123 to just return one issue (where ABC-123 is an issue that you know you can see in Jira) - does this work?

The permission that you need to check, for each project, is 

 

Screenshot_2.jpg

Warren
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.
November 18, 2019

The tags for this question show as cloud, if correct your code is showing username and password. For cloud now, you should be using the Jira user's e-mail address and an API token, otherwise you would get an error relating to authorisation

0 votes
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2019

Hello @ericreiner ,

are you able to see issues in these projects?

Please, try to check "Browse Projects" permission.

https://confluence.atlassian.com/adminjiracloud/managing-project-permissions-776636362.html

Even thought you are Site Admin, it is possible, that you don't have access to the projects.

ericreiner
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!
November 15, 2019

I am able to see issues, make changes, etc.  I explicitly added Browse Projects to myself but I am still not getting any responses.  

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 17, 2019

Hi @ericreiner 

I just tried to get projects from my cloud instance using GET /rest/api/3/project/search.

(I used Postman application with basic authentication: username + api token.)

Everything worked fine for me.

 

Which response code did you get? (return successful = code 200?)

Was there any message in the response?

Is it possible to attach here the whole response you obtained?

Did you try to perform any other action (like "get issue") using REST API?

Suggest an answer

Log in or Sign up to answer