Created
April 29, 2021 07:37
-
-
Save AnotherProksY/57ad81b58a9306e6e6edf8c3bd02590b to your computer and use it in GitHub Desktop.
Confluence get all users from groups via REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -a StringArray=("confluence-users" "confluence-administrators") | |
# I use httpie instead of curl, but you can adapt this script to use cURL. | |
for group in ${StringArray[@]}; do | |
output=$(https -b -a 'username:password' https://<base-confluence-url>/rest/api/group/$group/member | sed -e 's/[{}]/''/g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | grep displayName | cut -d ':' -f2 | sed -e 's/^"//' -e 's/"$//' | tr '\n' ',') | |
echo "$group;$output" >> any_filename_to_store_data.csv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment