Fix bug to export & modify other Script

This commit is contained in:
magikcypress
2021-03-18 15:01:01 +01:00
parent 4b8d73b473
commit f15b037b31
5 changed files with 43 additions and 15 deletions

View File

@@ -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;

View File

@@ -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";

28
qcs-bash/qs-qcs-assignments.sh Executable file
View File

@@ -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;

0
qcs-bash/qs-qcs-files-del-3days.sh Normal file → Executable file
View File

View File

@@ -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