Jump to content

REST, QlikSense authentication, webservice


Tjalve
 Share

Recommended Posts

Hello my fellow coders.

At my company we have an installation of a BI-solution called QlikSense (next generation of Qlikview if anyonw knows about it). In Qliksense i have several tasks that extract data from varius sources and display them as graphs and tables on a dashboard. The entire system is based on websockets (im not 100% sure what websockets actually is though...).

Anyways, I now have a need to externaly trigger theese reload tasks and this can be done using the QlikSense management API (http://help.qlik.com/sense/2.1/en-us/developer/#../Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Connect-API.htm)

This API uses REST to send commands and extract information from the Qliksense management console. Since i haven used this kind of API befor, im a bit lost but i have managed to create the following code: 

$objHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$objHTTP.open ("GET", "http://localhost/qrs/user/count", False)
$objHTTP.setRequestHeader ("Content-Type", "application/json")
$objHTTP.setRequestHeader("Accept","application/json")
$objHTTP.setRequestHeader("x-qlik-xrfkey","0123456789abcdef")
$objHTTP.send()
ConsoleWrite($objHTTP.responseText & @CRLF)

This is supposed to return all the users of the Qliksense enviroment, in JSON format, but the only thing i get is a HTML-based code. If i save that to a html file, and open it, i get a logon page. So i guess there is a problem with authentication. I checked the examples in the API documentation and also the topping on authentication. It say that if the sender supports it, the system should uyse standard windows authentication without any need for username/password or certificates.

If i just use the standard URL http://localhost/hub i get into the system withut logging on.

ANY help would be appritiated. Perhaps someone understands the documentation better then I do?

Link to comment
Share on other sites

Alright ive made some progress. Using "Msxml2.XMLHTTP.6.0" sitead, ihave been able to get the info i need using basic authentication. The question now if i can make it to use windows authentication? Since i dont want to save the password in clear text, i prerfer to use the current logged on users credentials. Any idéa on how to do that?

My vode so far:

$objHTTP = ObjCreate("Msxml2.XMLHTTP.6.0")
$objHTTP.open ("GET", "http://localhost/qrs/app/?Xrfkey=ABDHEFUELPYRVGLK", False,"my usernamer","my password")
$objHTTP.setRequestHeader("X-Qlik-Xrfkey","ABDHEFUELPYRVGLK")
$objHTTP.send()
$data = $objHTTP.responseText
ConsoleWrite($data & @CRLF)

 

Link to comment
Share on other sites

  • 7 months later...

Hi Tjalve

Who´re you?

I start to work whit this technology ( Sense - REST).

so I wanted to know how you went with your system?
I hope you can guide me to achieve consult with REST XML information or in other words, you know how it could connect to a Web services from Qlik sense?
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...