'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