Created
March 4, 2021 15:18
-
-
Save magikcypress/88c9640e03e583fe1a8dac110112c19e to your computer and use it in GitHub Desktop.
Assigment user & role to Space QSEoS
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
# Define your tenant url | |
tenant="$(cat ../secret/tenant)"; | |
# Define your API key | |
apiKey="$(cat ../secret/api-key)"; | |
# Define your space | |
space="$(cat ../secret/space)"; | |
# Define Url Space | |
urlSpace="https://$tenant/api/v1/spaces"; | |
# Get space Id | |
spaceId=$(curl -s "$urlSpace" -H "Authorization: Bearer $apiKey" | jq '.data[] | select(.name == '\"$space\"') | .id' | tr -d \"); | |
# Define url assignment | |
url="https://$tenant/api/v1/spaces/$spaceId/assignments" | |
# Get Assignment | |
listAssig=$(curl -s -X GET "$url" -H "Authorization: Bearer $apiKey" | jq -r '.'); | |
echo $listAssig; | |
# Define url Add user | |
url="https://$tenant/api/v1/spaces/$spaceId/assignments" | |
# Add User Assignment | |
Assig=$(curl -s -X POST "$url" -H "Authorization: Bearer $apiKey" -d '{"type": "user", "assigneeId":"iuWz3WIBpkbaVPF8jTVZ43flt-cNb4ez","roles":["consumer"]}'); | |
echo $Assig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment