
Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
QRS API: Upload a file to a content library (Powershell)
Last Update:
Mar 8, 2021 1:24:42 AM
Updated By:
Created date:
Oct 4, 2018 6:17:03 AM
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:
- To delete uploaded file from library use Remove/delete a file from a content library using PowerShell
- You can also Prevent an upload of specific file extensions to content libraries
1,926 Views