It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rest API Returns no projects even though I am site admin

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
Hana Kučerová Community Leader Nov 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.

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

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?

0 votes
Warren Community Leader Nov 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 Community Leader Nov 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

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you