How to list all projects a user has access to using Jira's REST API?

As an admin, I should be able to list all projects a specific user has access to. How to do that using the REST API without too convoluted code still escapes me... Any idea how to do that gracefully? Thanks!

5 answers

1 accepted

This widget could not be displayed.

I am afraid you will have to make multiple calls in that case.

https://docs.atlassian.com/jira/REST/latest/#d2e4366 gets you all users with given permission in a project.

https://docs.atlassian.com/jira/REST/latest/#d2e2710 gets you the project role view.

Hope one of these helps.

Ok, thanks for the tips. I will try to combine calls as suggested.

None of these links go to a specific set of the documentation anymore. 

@Jobin Kuruvilla [Go2Group], unfortunately those links points to nothing and I am working on a similar problem.
Hope you could help

The older links are now broken it seems. There is a new experimental API which you can try out. It gets the job done in one call.

Check out "Get permitted projects"

This widget could not be displayed.

He Luigi,

You can do it with /rest/api/2/issue/createmeta: https://docs.atlassian.com/jira/REST/latest/#d2e550

Piece of my JavaScript:

var projUrl = "/rest/api/2/issue/createmeta";
  var availableProjectsArr = [];
  jQuery.ajax({
    url : projUrl,
    headers : {
      "Accept" : "application/json"
    },
    success : function(jsonStr) {
      var json = $.parseJSON(jsonStr);
      for (var i = 0; i < json.projects.length; i++) {
        var project = json.projects[i];
        availableProjectsArr.push(project.key);
      }
      ...

Just out of interest: where do you use JavaScript to access REST? I am using VBA from Excel, to retrieve Confluence information to display in excel.

This widget could not be displayed.

Depends on what access you are looking for. If it is 'Create', use what @Volodymyr Krupach suggested.

If you are looking for all projects visible to the users (Browse access), use GET on /rest/api/2/project.

This widget could not be displayed.

Hi,

Thank you for your answers. I am looking for a way to fetch (browse) all projects a particular user (not me) has access to. No need to create. Using /rest/api/2/project works indeed, but that gives me the list of all projects visible to me as a JIRA admin.

I can do what I want through Jira's web interface: "JIRA Administration" / "User management", then "Projects Roles" for a specific user. I am looking for a way to emulate that using the REST API, being logged in as a JIRA Admin. Hopefully without too many looped calls... Thanks again for the help!

Any luck to make it work since then?

This widget could not be displayed.

Sorry for the late answer!
We had the same issue and wrote a plugin which extends the REST-API of Jira. You can specifiy a user and get the users projects and the permissions and roles assigned to the projects. You can also filter for specific permissions.
The plugin can be found here:
https://marketplace.atlassian.com/plugins/de.materna.jira.plugins.userProjectRest

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

564 views 25 15
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you