Bulk get project roles for a user

Hello there!

We are exploring working with Project roles in one of our new features but I’m afraid we have met some limitations with the Jira Cloud REST API.

Do you know if there is any way to get the user roles for a list of projects? This feature is related will apply for a (maybe huge) list of projects and it is not an option for us to call an endpoint like this for every project.

It will be perfect if it exists something like this one but for roles instead of project permissions.

Thanks in advance!

Hello @alvaro.aranda,

Although there is no bulk call for this, one possible approach is to iterate over your project list, and then call Get project roles for project REST API. This API will return a list of roles a user can be in a project together with the endpoint to dig deeper into each project role.

Should you want to get the users for each project role, you can go through the response body of the above call and check the actors array which should look something like this:

{
  "actors": [
    {
      "actorGroup": {
        "displayName": "jira-developers",
        "groupId": "952d12c3-5b5b-4d04-bb32-44d383afc4b2",
        "name": "jira-developers"
      },
      "displayName": "jira-developers",
      "id": 10240,
      "name": "jira-developers",
      "type": "atlassian-group-role-actor",
      "user": "jira-developers"
    },
    {
      "actorUser": {
        "accountId": "5b10a2844c20165700ede21g"
      },
      "displayName": "Mia Krystof",
      "id": 10241,
      "type": "atlassian-user-role-actor"
    }
  ],
  "description": "A project role that represents developers in a project",
  "id": 10360,
  "name": "Developers",
  "scope": {
    "project": {
      "id": "10000",
      "key": "KEY",
      "name": "Next Gen Project"
    },
    "type": "PROJECT"
  },
  "self": "https://your-domain.atlassian.net/rest/api/3/project/MKY/role/10360"
}

Hope this helps.

Ian

1 Like

Hello @iragudo !

We need to get something in bulk because the performance is critical here and we need to manage lots of projects at the same time for this new feature so this is not an option. But, thanks for the suggestion!

1 Like