Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
A client is ramping up the usages of their Qlik Sense Aug 2021installation (single node). One of the things they want to do is to be able to trigger the reload tasks from outside the server using PowerShell scripts.
The first issue I found when trying to connect to the QRS API is that there is the IIS Manager running on the Qlik Sense server. The IIS is running some websites other than Qlik Sense and port 443 is bind to the default website.
The Qlik Sense Proxy's default port is set to 8443; both the Hub and QMC are reached via https://Server:8443/ url.
When I tried to access the QRS API using https://Server:8443/QRS/about?xrfkey=12345678qwertyui, I got the response:
'400 - Bad Request - Qlik Sense'
When I tried https://Server:4242/QRS/about?xrfkey=12345678qwertyui, I got the response:
'Unable to connect to the remote server'
The Proxy and Virtual Proxy are the Central (default)
This is the full PowerShell scripts:
#Certificate Trust Policy
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;
}
}
"@
#$AllProtocols = [System.Net.SecurityProtocolType]'Tls12'
#[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
$hdrs.Add("X-Qlik-User", "UserDirectory=INTERNAL;UserId=sa_repository")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://Server:4242/qrs/about?xrfkey=12345678qwertyui"
Invoke-RestMethod -Uri $url -Method Get -Headers $hdrs -Certificate $cert
Question: What am I missing in order to make the call to the QRS API?