In order to be able to use a file with the content library, it first needs to be referenced by the Qlik Repository.
Environments:
Qlik Sense Enterprise on Windows any version
Below is a Powershell example of how to upload a file to a content library with the Repository API. Note this example uses certificate-based authentication.
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","iX83QmNlvu87yyAB")
$hdrs.Add("X-Qlik-User","UserDirectory=DOMAIN;UserId=Administrator")
$imagePath = "c:/decisiontree.zip"
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://qlikserver1.domain.local:4242/qrs/ContentLibrary/MyLibrary/uploadfile?externalpath=test1.zip&overwrite=true&xrfkey=iX83QmNlvu87yyAB"
Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs -InFile $imagePath -ContentType 'multipart/form-data' -Certificate $cert
Related Content: