REST API to change project admin in multiple projects

Arun Unnikrishnan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 16, 2024

I am trying to bulk update project admin in few projects. I want to achieve this using REST API. 

lets say I have around 05 projects in which I want to remove a person X, how can i do that? I tried few things but didn't get an results. 

I am not sure what is role actor that the document says. 

My need is : I have a jql (project in (A, B, C, D) 

I wat to add/remove a person from the project admin role 

Any help would be appreciated. 

1 answer

1 accepted

0 votes
Answer accepted
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 16, 2024

Hi @Arun Unnikrishnan 

Let me try to help you by sharing the necessary REST APIs you need to achieve this.

Each project in Jira has its own set of roles, each has unique IDs. To get the role ID for the Project Admin role, you can fetch the roles for one of the projects.

GET /rest/api/3/project/{projectIdOrKey}/role

This will return a list of roles with their unique IDs. You need to identify the ID value for the Project Admin role.

To remove a user from the Project Admin Role you can use below REST service:

DELETE  /rest/api/3/project/{projectIdOrKey}/role/{roleId}?user=username

To add a user to the Project Admin Role you can use below REST service:

POST /rest/api/3/project/{projectIdOrKey}/role/{roleId}

I hope it helps.

 

 

 

Arun Unnikrishnan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2024

Appreciate the help @Tuncay Senturk 

 

I did try this and it works.

My ask is actually to feed the ProjectId or Key from an array into  rest/api/3/project/{projectIdOrKey}/role/{roleId so that I don't have to run the API multiple times.

 

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 18, 2024

You need to write a script that iterates through the projects and roles. The script can be written in either Python or Groovy in which you may retrieve project id values as an array. Likewise, roleId values that you want to add/remove a user.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events