Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a need to retrieve information from a webservice(rest API) which require me to first login in.
Is there anyone that have an example for this using a macro script?
The examples a have found do not have the login post included first. How is this done?
Depending on the webservice you need to use you could try the API connector:
You could also write (or ask someone) a php script to do the login and then use the Qlikview webfile wizzard to connect to php server on which the php script is located.
gr.
Frank
Hi
I only get thatr I am not authirzed when using your link...
Hi people,
I have a macro about web services REST, this macro his functions are: Autetification and create xml file.
I had problem with the chace in the call http, but this problem now is resolved with some parameters in the object http of the vba.
I hope you like it,
Miquel.
XMAS!
Function restapi()
'msgbox ("Hola")
' LOGIN AND PASSWORD
vUsuario = "XXXXXXX@XXXXXX.com"
vPassword = "xxxxx"
' your url REST
vQueryKPI="https://apirest.XXXXXXXXXXXXXXXXXXXXXX.com/v1/xml/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Set g_objHttp=CreateObject("MSXML2.XMLHTTP")
' send login and password set
g_objHttp.Open "GET",vQueryKPI,False,vUsuario,vPassword
' resolve problem: disable chace call htpp,the same data in every time refresh....
g_objHttp.setRequestHeader "If-None-Match","some-random-string"
g_objHttp.setRequestHeader "Cache-Control","no-cache,max-age=0"
g_objHttp.setRequestHeader "Pragma","no-cache"
g_objHttp.send()
g_objResult=g_objHttp.responseText
g_objResult = replace(g_objResult, ">", ">")
g_objResult = replace(g_objResult, "<", "<")
'TMP PATH YOUR PROCESS XML FILE AFTER CALL REST
Path = "../xxxxxxxxxxxxx/xml/"
FileName = Path & "queryKPI.xml"
Dim oStream
Set oStream = CreateObject("ADODB.Stream")
tPath = "1"
' resolve problem encondig caracter
With oStream
.Open
.CharSet = "utf-8"
.WriteText (g_objHttp.responseText)
.SaveToFile FileName, 2
End With
Set g_objHttp = Nothing
Set oStream = Nothing
'msgbox("adeu")
end Function