Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to replicate a local structure (folder/subfolder/file) in the Data Files section of a space.
I'm using Qlik-cli version 2.27.0
Here’s a simplified version of my script:
LOCAL_ROOT_PATH="./roottest"
SPACE_NAME="Developers - Demo & LAB"
SPACE_ID=$(qlik space ls --name "$QLIK_SPACE_NAME" --json | jq -r '.[0].id')
echo spaceID $SPACE_ID
qlik context use horsadev.eu.qlikcloud.com
CONN_ID=$(qlik data-file connection ls --spaceId $SPACE_ID | jq -r '.[0].id');
echo connID $CONN_ID
folder_response=$(qlik data-file create \
--folder \
--name "cris_folder" \
--connectionId $CONN_ID)
echo $folder_response
Unfortunately, it’s not working.
When I run the script, I get the following error:
cristiandalsanto@Cristians-MacBook-Air testandrea % ./script.sh
spaceID 5ed10e05e66b1c00000b91e
Context: mycontext
connID c40dd41a-7ed8-455a-b52d-0000000
Error: 400 Bad Request
{
"errors": [
{
"title": "Request to create/update a folder must not contain a Data body nor a tempContentFileId.",
"code": "HTTP-400"
}
]
}
It seems the issue is related to the create method, but I can’t figure out what I’m doing wrong.
Any ideas or help would be much appreciated!
Cristian
@cristian_dalsanto - I managed to make it work like this:
qlik data-file create --folder --name "folder_1" --tempContentFileId "" --file "" --connectionId <connection_id>
@cristian_dalsanto - I managed to make it work like this:
qlik data-file create --folder --name "folder_1" --tempContentFileId "" --file "" --connectionId <connection_id>
@jprdonnelly for the pure task of creating the folder. If you want to just put a file in a folder (without an additional call to create the folder), you can do this (PowerShell syntax):
$space_name = "Sandbox - Folders"
$space_id = (qlik space ls --name $space_name | ConvertFrom-Json).id
$connection_id = (qlik data-file connection ls --spaceId $space_id | ConvertFrom-Json).id
# create a file in the root of the directory
qlik data-file create --name "csv.csv" --connectionId $connection_id --file C:\etc\data\CSV.csv
# create a file in a directory
qlik data-file create --name "some/folder/csv.csv" --connectionId $connection_id --file C:\etc\data\CSV.csv
yes @Levi_Turner, it works. I actually used this approach in my script to quickly provide a response to the customer. However, I'm looking for a solution that also allows me to create a structure including empty folders
Thanks @jprdonnelly , it works perfectly. I hadn’t realized that I needed to explicitly pass an empty tempContentFileIdparameter — I assumed its default value was ""