Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Paul_Antonio
Contributor II
Contributor II

How to use Qlik API on client side

Hello fellows,

I am using Qlik API to embed Qlik object into my web applications (already did by using iframe). But I am stuck at the execution model and wonder exactly how to use it. For more details, as Qlik API reference document, after creating config object, we register with method require.config() to make connection to Qlik Sense server, then we add module Qlik API and keep using API function to open app and get object, as following code:

var config = {
		host: "qliksenseserver.com",
		prefix: "/hdr/",
		port: "",
		isSecure: true
	};

require.config(config);

require.config( {
	baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
	qlik.setOnError( function ( error ) {
		$( '#popupText' ).append( error.message + "<br>" );
		$( '#popup' ).fadeIn( 1000 );
	} );
	$( "#closePopup" ).click( function () {
		$( '#popup' ).hide();
	} );

	//callbacks -- inserted here --
	//open apps -- inserted here --
	var app = qlik.openApp('e7577372-3cde-4854-806b-5dc9d57989c3', config);

	//get objects -- inserted here --
	app.getObject('QV01','akDGX');
	app.getObject('QV02','VtfsZDc');
	app.getObject('QV03','KnASd');
	app.getObject('QV04','vCNaSe');

} );

I have create proxy named "hdr", accept header authentication: hdr-user: qliksenseserver.com/paul

My question is: whether I can run these API on client side? If I could, how can I authenticate and get ticket as well as login session on client machine?

My problem can be briefed as following graphic:Qlik sense embed.gif

The syntax

require( ["js/qlik"], function ( qlik )

looks like Node JS function. Is this true? And how could I run API on client side?

If I cannot, could you recommend me proper model for my problem?

Thank you guys for your time.

Labels (3)
2 Replies
ErikWetterberg

Hi,

This looks a bit strange: the config object at the beginning is the qlik config, not rrequirejs config, so the line require.config(config) should not be there. The config object should be used (and is used) in qlik.openApp().

BTW the require call is part of requirejs (https://requirejs.org/), not Node in this scenario.

 

Paul_Antonio
Contributor II
Contributor II
Author

Thank your for your attention in my problem.

I will adjust my code above.

Do you have any solution for authentication and authorization directly from client to Qlik server (no need web application)?