Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I tried to export Qlik sense application using below power shell script. But I am getting "HTTP 403 Forbidden" error.
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 ("Certificate path\client.pfx", "Migrate2018")
$xrfkey = 'somerandomstring'
$headers = @{"X-Qlik-User"="UserDirectory=INTERNAL;UserId=sa_repository"; "X-Qlik-Xrfkey"=$xrfkey; }
$base = "Destination-File path"
$qrshost = "Host-Name"
$apps = Invoke-WebRequest "https://$( $qrshost ):4242/qrs/app/full?Xrfkey=$xrfkey" -Certificate $certificate -Headers $headers
$apps.Content | Out-File -FilePath "$base\apps.json" -Force
foreach($app in ($apps | ConvertFrom-Json)){
$exporttoken = Invoke-WebRequest "https://$( $qrshost ):4242/qrs/app/$( $app.id )/export?Xrfkey=$xrfkey" -Certificate $certificate -Headers $headers -TimeoutSec 999 | ConvertFrom-Json
Invoke-WebRequest "https://$( $qrshost ):4242/qrs/download/app/$( $app.id )/$( $exporttoken.value )/$( $app.id )?Xrfkey=$xrfkey" -Certificate $certificate -Headers $headers | Out-File -FilePath "$base\apps\$( $app.id ).qvf" -Force
}
Thanks!