Step 1 - Locating
This topic describes how to connect to Qlik Sense through Desktop or Server. Connection to Qlik Sense is established by using an URI. The composition of the URI depends on whether it is Qlik Sense Desktop or Qlik Sense Server, and on the applied security settings.
Qlik Sense Desktop
An URI to Qlik Sense Desktop uses either the websocket protocol ws, or http. The machine is specified with either localhost or 127.0.0.1. By default Qlik Sense Desktop runs on port 4848, which has to be specified in the URI.
Example: Connect to Qlik Sense Desktop
Uri uri = new Uri("ws://127.0.0.1:4848");
ILocation location = Qlik.Engine.Location.FromUri(uri);
Uri uri = new Uri("http://localhost:4848");
ILocation location = Qlik.Engine.Location.FromUri(uri);
Qlik SenseServer through the proxy
An URI to Qlik Sense Server, through proxy, uses protocol http or https if SSL is applied. The default port number is 80 (http) or 443 (https), which can be omitted in the URI.
Make sure:
- that the firewall settings are correct for the port numbers (see proxy configuration....)
- that no IIS (or something else) is running on default port 80 (or 443) since this will conflict with Qlik Sense. In order to run http this has to be enabled in the proxy (through the QMC), https is default setting.
- to add your local computer or domain to the "Websocket origin white list" in the remote QMC. Add you full computer name (or domain) here: QMC -> Proxies -> (Edit Proxy) -> Default proxy Properties -> Websocket origin white list.
Example: Connect to Qlik Sense using Uri
Uri uri = new Uri("http://<machine>");
ILocation location = Qlik.Engine.Location.FromUri(uri);
Uri uri = new Uri("https://<machine>");
ILocation location = Qlik.Engine.Location.FromUri(uri);
Example: Qlik Sense Server with out proxy
When connecting to Qlik Sense running on server with out proxy, the default port number is 4747, which has to be specified in the URI.
Uri uri = new Uri("https://<machine>:4747");
ILocation location = Qlik.Engine.Location.FromUri(uri);
Connect and communicate with Qlik Sense
The examples below show how to connect to Qlik Sense in order to retrieve the version number. For more information about the different authentication methods, see Accessing Qlik Sense.
Example: Qlik Sense Desktop
private void PrintQlikSenseDesktopVersionNumber()
{
// Single Qlik Sense Desktop with no special settings
ILocation location = Qlik.Engine.Location.FromUri(new Uri("ws://127.0.0.1:4848"));
// Defining the location as a direct connection to Qlik Sense Personal
location.AsDirectConnectionToPersonalEdition();
using (IHub hub = location.Hub())
{
Console.WriteLine(hub.ProductVersion());
}
}
Example: Qlik Sense Server through the proxy
private void PrintQlikSenseServerVersionNumber(object sender, EventArgs e)
{
// When connecting to Qlik Sense Server through proxy, use a URI containing http/https and IP/Machine name.
Uri uri = new Uri("http://<machine>");
ILocation location = Qlik.Engine.Location.FromUri(uri);
// Defining the location as a connection to Qlik Sense Server using NTLM Authentication with parameter false (since using http).
location.AsNtlmUserViaProxy(proxyUsesSsl:false);
using (IHub hub = location.Hub())
{
Console.WriteLine(hub.ProductVersion());
}
}
Learn more
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!