Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

QRS API: Upload a file to a content library (Powershell)

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

QRS API: Upload a file to a content library (Powershell)

Last Update:

Mar 8, 2021 1:24:42 AM

Updated By:

Sonja_Bauernfeind

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:


 

Labels (2)
Contributors
Version history
Last update:
‎2021-03-08 01:24 AM
Updated by: