diff --git a/qcs-bash/get-info.sh b/qcs-bash/get-info.sh index 439e7be..d458621 100755 --- a/qcs-bash/get-info.sh +++ b/qcs-bash/get-info.sh @@ -17,3 +17,5 @@ curl -s "https://$tenant/api/v1/data-connections" -H "Authorization: Bearer $api # Get Files curl -s "https://$tenant/api/v1/qix-datafiles" -H "Authorization: Bearer $apiKey" | jq; +# Get Groups info +curl -s "https://$tenant/api/v1/qlik-groups/B8GvT7XQ1C6j3TBZ6wYo1O3TBSAew2dp" -H "Authorization: Bearer $apiKey" | jq; diff --git a/qcs-bash/qs-qcs-app-export.sh b/qcs-bash/qs-qcs-app-export.sh index 4fd786a..27a6f7d 100755 --- a/qcs-bash/qs-qcs-app-export.sh +++ b/qcs-bash/qs-qcs-app-export.sh @@ -6,21 +6,23 @@ tenant="$(cat ../secret/tenant)"; apiKey="$(cat ../secret/api-key)"; # Define app id -AppId='d8c34cec-b655-492e-a5b9-ae15356d03fb'; +appId='d8c34cec-b655-492e-a5b9-ae15356d03fb'; # Setting URL url="https://$tenant/api/v1/apps/$appId"; urlE="https://$tenant/api/v1/apps/$appId/export"; -urlTmp="https://$tenant/api/v1/apps/temp-contents/601411722823140001ebc69c"; -# Get app info +# Get app name nameApp="$(curl -s -X GET -# "$url" -H "Authorization: Bearer $apiKey" | jq -r '.attributes | .name')"; echo $nameApp; +# Replace name App space per Underscore +nameApp=`echo $nameApp | tr ' ' '_' `; -# Export file -export="$(curl -v -i -X POST -# "$urlE" -H "Authorization: Bearer $apiKey")"; -echo $export.Headers.Location +# Get temp location +export="$(curl -si -X POST "$urlE" -H "Authorization: Bearer $apiKey" | grep -oP 'location: \K.*' | tr -d \")"; +urlD="https://$tenant$export"; +echo $urlD; -#getTempContent="$(curl -v -i -# "$urlTmp" -H "Authorization: Bearer $apiKey")"; -#echo $getTempContent -#download="$(curl -X GET "https://$tenant/ -H "Authorization: Bearer $apiKey")" +sleep 3; +# Download temp files +curl -s -X GET "$urlD" -o "$nameApp.qvf"; diff --git a/qcs-bash/qs-qcs-assignments.sh b/qcs-bash/qs-qcs-assignments.sh new file mode 100755 index 0000000..2723d0c --- /dev/null +++ b/qcs-bash/qs-qcs-assignments.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# 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; diff --git a/qcs-bash/qs-qcs-files-del-3days.sh b/qcs-bash/qs-qcs-files-del-3days.sh old mode 100644 new mode 100755 diff --git a/qcs-bash/qs-qcs-files-download-temp-contents.sh b/qcs-bash/qs-qcs-files-download-temp-contents.sh index a16042c..984a3d7 100755 --- a/qcs-bash/qs-qcs-files-download-temp-contents.sh +++ b/qcs-bash/qs-qcs-files-download-temp-contents.sh @@ -4,12 +4,8 @@ tenant="$(cat ../secret/tenant)"; # Define your API key apiKey="$(cat ../secret/api-key)"; -# Define filename -FILENAME="../files/France-Team-Ecoles-Normandie.csv" -# Define space -space="$(cat ../secret/space)"; # Define url -url="https://$tenant/api/v1/temp-contents/60158d80cc3c9d00012dc6c0" +url="https://$tenant/api/v1/temp-contents/605357d75ddea00001182029" # Download temp files -curl -si -X GET "$url" -H "Authorization: Bearer $apiKey" +curl -s -X GET "$url" -H "Authorization: Bearer $apiKey" -o Ecoles-Francaise.qvf