Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a curl command to add an ADOM group in multiple projects

Ipsita Dash February 28, 2018

Hi,

I have a curl command which can add a group named "SVC-OneHygieia" to the Administrators role in all jira projects.

curl -D- -u admin:sphere -X POST -H "Content-Type: application/json" --data '{"group":["SVC-OneHygieia"]}' http://10.20.30.40:8080/rest/api/2/project/TEST/role/12345

Now, how to modify this command so that i can add above mentioned group to all the jira projects. I have around 2000+ jira projects.

 

Note : 

  • admin is your username
  • sphere is your password
  • http://10.20.30.40:8080 is JIRA Base URL
  • TEST is project key 
  • 12345 is role ID

 

Thanks,

Ipsita Dash 

1 answer

0 votes
Tarun Sapra
Community Champion
February 28, 2018

Hello @Ipsita Dash

This is a common quesiton on this forum. The way to do it would be to fetch the project list using REST API. Traverse over the list (for loop) and make the REST to add the group to a specific role in the project.

Get all projects

GET /rest/api/2/project

and then traverse over the project keys returned in the response.

Ipsita Dash February 28, 2018

Hi Tarun,

Thanks a lot for your solution. For loop thought crossed my mind but i am not sure how effectively it will work for more than 2000 projects.

Also adding 2000+ projects in a for loop will be challenging.

Can you give an example.

Thanks,

Ipsita Dash

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events