'Add actors to project role' API returns 404

Hi,

I try to add a user to an project role for a project.
I use https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-role-actors/#api-rest-api-3-project-projectidorkey-role-id-post

  const bodyData = `{
    "user": ["xxx-yyy-my-user-account-id"]
  }`;

  const response = await api.asApp().requestJira(route`/rest/api/3/project/MIB/role/10006`, {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: bodyData,
  });
  console.log(`Response: ${response.status} ${response.statusText}`);

I always get a 404 response.

  • The ‘MIB’ project exists and the ‘10006’ project role also exists.
  • It works for other API (both GET or POST methods), like ‘create project role’ API.
  • My manifest.yml files includes “manage:jira-configuration”
  • Same problem in a resolver or in the frontend (with adaptations)

Have you experienced this problem already? Could someone try to run this code and tell me if it works?
Thanks for your help!

I have tried directly in Chrome console (see Making HTTP Requests using Chrome Developer tools - Stack Overflow) :

fetch('https://xxx.atlassian.net/rest/api/3/project/MIB/role/10006', {
  method: 'POST',
  body: JSON.stringify({
    "user": ["xxx-accountid-xxxxx"]
  }),
  headers: {
    'Content-type': 'application/json; charset=UTF-8'
  }
})
.then(res => console.log(res))

Same result: 404 response.

Just found where the problem was coming from…
If you create a “team-managed” project, Jira creates special Project Roles that you can’t see in the Settings > System > Project Roles . These project roles can only be used on “team-managed” projects, and if you try to call the add actors to project role API on a “company-managed” project, it returns 404. The opposite is also true, your custom Project Roles can’t be applied on “team-managed” projects.

1 Like