Root API
This API is reliable and breaking changes are unlikely.
qlik
The Root API is the external interface to Qlik Sense and is available as the qlik namespace. It provides methods opening apps, get a reference to the current app, set the specific language, and registering callbacks for error handling. The Root API also holds methods for listing available apps and extensions, and registering extensions that you build on the fly (using the Visualization API).
Version history
Each method and property contain information around when it was introduced, updated, deprecated or removed. A list of all relevant API changes per version release can be found in API version history.
Version state | Details |
---|---|
Introduced | 1.0 |
Getting started
The Root API is available for mashup developers as the qlik namespace.
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
}
Examples of use
Learn what you can do with the Root API.
Get a list of available apps (Qlik Sense Enterprise on Windows)
You can use the getAppList method to get a list of all apps that are available to you. It opens a WebSocket, gets the app list, and then closes the WebSocket.
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
qlik.getAppList(function(list){
var str = "";
list.forEach(function(value) {
str += value.qDocName + '('+ value.qDocId +') ';
});
alert(str);
}, config);
Open an app and access the App API
You must connect to the Qlik Sense app containing the objects you want to display on your web page. You do this with the qlik.openApp method.
Example:
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
// insert Qlik objects into the page.
app.getObject(document.getElementById('LB01'), 'uPyZavD');
}
You can also have multiple apps open at the same time.
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
var app = qlik.openApp('2abac31e-3b46-4b78-8bxf-c5cea1d2514d', config);
var app2 = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
In return you get an app JavaScript object with app methods.
Set a specific language
You can set a specific language for the Qlik Sense session. It should be defined before the app is opened, meaning the qlik.setLanguage method should be called before the qlik.openApp method is called.
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
require(["js/qlik"], function(qlik) {
//set the language to something else than default language
qlik.setLanguage('es-EN')
//open apps -- inserted here --
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
// insert Qlik Sense objects into the page
app.getObject(document.getElementById('LB01'), 'uPyZavD');
}
Get a global reference and access the Global API
You can open a WebSocket connection to the Qlik associative engine by calling the qlik.openApp method to get an app object in return, containing global methods.
var config = {
host: 'QSE_domain',
prefix: '/',
port: 443,
isSecure: true
};
const app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
var global = app.global;
global.getAuthenticatedUser(function(reply){
alert(reply.qReturn);
});