How to add group to all projects Edited

Hi! Can anybody help me pls? How can i add a group to the role in all projects via REST API? Since there are a lot of projects and it is very difficult to do this by hands.

I have a jira version 6.3.8

 

Thanks.

2 answers

1 accepted

This widget could not be displayed.

Ok, i found one way.
Take the ID of all projects and rewrite them in a text file
Next, create a script with the following code:

for (( i = 1; i < 8; i++ ))
do
key=$(sed -n $i"p" $1)
echo $key
key=${key%$'\r'}
curl -x http://YourProxyServer:3128/ -i -H 'Content-Type: application/json' -X POST -d '{"group": ["YourGroup"]}' -u user:password https://jira_url/rest/api/latest/project/${key}/role/{roleid}
done
This widget could not be displayed.
Josh Steckler Community Champion Sep 21, 2017

When I need to do this, I open in excel the list of project keys (copy and paste from admin page), then build a lot of curl commands that put a group in a role for a single project.

Repeat this command for every project:

curl -i -H 'Content-Type: application/json' -X POST -d '{"group": ["GroupName"]}' -u username:password https://<jiraurl>/rest/api/latest/project/<projectKey>/role/<roleId>

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

41 views 2 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you