Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone.
Im currently wrinting a small program in a language called Autoit. Its a Script based programing language that can be used to automate Windows tasks. The syntax is very similar to VB for exmple.
I have used this language several times to automate stuff in Qlikview desktop usiong the COM API and it worked well.
Just for the fun of it, im trying to get a connection to the Qlik Sense QMC. The idee is to get some basic info about the server. Like users, tokens, tasks and stuff like that. However im not having mutch luck.This is my simple code so far.
$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)
The response text i get is HTML and if i pipe it to an html file, i get a page that ask me to logon (since its s static HTML page, i cannot logon).
I was under the impression that if you used the proxy URL and not the API directly, you could use the current logged on user to get the access you need. If i just browse to http://localhost/hub im loged on without ever needing to add more credeentials.
So the question is how to proceed? I have tried reading the documentation (https://help.qlik.com/sense/1.0/en-us/developer/Subsystems/Qlik_Sense_Repository_Service_API/Content...) but that didnt get me anywhere. I even did the example connection using MS Powershell and i got the EXACT same response I did with the code above.
Help needed
/G
That's because your browser automatically re-directs you to the windows authentication module and authenticates you and signs you in to QMC.
Your request in AutoIt is not authenticating you as a user hence it's giving you the login dialog back.
I would recommend you check out these articles on how to authenticate your requests to the QMC api Authenticating requests
Hi!
As i stated in my first post. I have checked the documentation and i have even made the powershell example (using windows authentication) and even then i got the login page. So i know that the authentication is the problem. But i dont know how to solve it.
Well, if you check the help pages I linked you to it describes how to authenticate users.
Not knowing AutoIt but I guess you could potentially hardcode your windows credentials somewhere, follow the redirect and enter those into the form and submit them. That would authenticate you.
Otherwise use the Qlik Sense Certs and request a ticket for yourself and append that to the end of the url you are requesting and you will be authenticated as the user that the ticket was requested for, it's all described in the help articles above.
You also have to make sure cookies and such are respected and persisted between http requests so the session is not terminated.
Hi Alexander, the link is not working anymore? Could you please updated it or post the new one?
Cheers,
Andrés
Got it, I'll post it here in any case someone needed: