Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

gustavgager
Contributor II

Access data from QlikSense from a standard VB or JS script

Hi everyone.

In qlikview there was a great COM-API that i could use to automate fuctions and export pictures and data from from an external source like a VB-script or in my case Autoit-script.

Now i would like to do similar things in Qliksense. The goal is to have a script that I can run that opens a QS app, doing a few selections, export a few images, and then close down.

Now, there are alot of diffrent APIs. I have gotten the managemnet API working (witch uses REST) but the functionality that i want to use, doesnt seem to be avilible trough REST. It seems that the API needed to do what I want is the same ones that you use for creating mashups and extentions.

Im not interested in creating extensions or mashups, i just want to be able to automate a few things so if anyone have some sample code, that would be great.

Any help is appritiated.

6 Replies
Employee
Employee

Re: Access data from QlikSense from a standard VB or JS script

Hey Gustav,

You'd want to use Engine API for that. This is a javascript implementation of the Engine API: GitHub - mindspank/qsocks: A lightweight promise wrapper around the Qlik Sense Engine API

This is also a project that exports charts to images using phantomjs which maybe can be used as inspiration?

https://github.com/mindspank/chartcacher

gustavgager
Contributor II

Re: Access data from QlikSense from a standard VB or JS script

Hi Alexander.

Yes i have started to look at qsocks and it looks promesing. However i could not actually get anything working from a standard html or js file. Is there any examples anywhere that basicly works out of the box? That way i could change settings and learn how it works.

Employee
Employee

Re: Access data from QlikSense from a standard VB or JS script

This example should work fine if you are accessing the page over localhost

qsocks/connect-browser.html at master · mindspank/qsocks · GitHub

Otherwise you can remove the config from qsocks.Connect() and it will connect to a local desktop installation if it's up and running.

PS. I do recommend installing Nodejs, especially if you intended to do any automation.

gustavgager
Contributor II

Re: Access data from QlikSense from a standard VB or JS script

Thank you Alexander. I have never written anyything in javascript so this wioll probably take some time. But i think i get the basics and i will try to get something working.

The example you provieded does not seem to give you nay feedback if the connection was succsessfull or not. Witch means that i dont knwo what the script actually did

Im also wondering about Authentication. Since most of the other qsocks examples require an client-cert exported from the server. I would like to skip the certificates if its possible but im starting to realize that I probably cant.

Employee
Employee

Re: Access data from QlikSense from a standard VB or JS script

All methods in qsocks return Promises so normal error handling practices apply, either add a .catch() block or catch per method errors.

qsocks.Connect().then(promiseResolvedFunction, promiseRejectedFunction).catch(catchAnyRejectedPromisesFunctionNotHandled)

For authentication it's certainly easier to use the certificates (if you are using NodeJS, not in the browser) but you can also use normal authentication methods such as Ticketing which is the out of the box authentication mechanism. It will grow your solution quite substantially of course since you now have to handle authentication.

With the old COM api you didn't have to deal with authentication because if you had access to the qvw there were no authentication so you can equate having access to the qvw as having access to the client certificates.

Not applicable

Re: Access data from QlikSense from a standard VB or JS script

Hi,

There is also a .NET SDK that might be useful. You can find more documentation and examples here http://help.qlik.com/en-US/sense-developer/2.2/Content/expand.htm
There are also more examples available on GitHub and Qlik Branch.

Best regards
Lars-Göran Book

Community Browser