I have been struggling to make this work. I have a VBA code that tries to get data via REST API. It does get data correctly when it is run for the first time but after the second time it does not get the updated data but gets the same data as in the first call. This issue is replicable every time I call the GET call multiple times.
My VBA code is as following ("Second run" above means running Main for the second time):
Sub Main()
Dim MyHtml As String
Dim MyXmlResponse As String
MyHtml = "..."
MyXmlResponse = DoRestCall(MyHtml, "GET") ' Result in the second or later run is always the same as in the first run even the data is updated
End Sub
Function DoRestCall(Html As String, RestCallAction)
Dim XmlHttp As Object
Dim XmlHttpResponse As String
Set XmlHttp = CreateObject("MSXML2.XMLHTTP")
Call XmlHttp.Open(RestCallAction, Html, False)
XmlHttp.setRequestHeader "Authorization", "Basic " + _
"EncodedCredntial"
XmlHttp.setRequestHeader "Content-Type", "application/json"
Call XmlHttp.Send
XmlHttpResponse = XmlHttp.responseText
DoRestCall = XmlHttpResponse
Set XmlHttp = Nothing
End Function
Would somebody kindly advise what I am missing? Please let me know if more information/clarification is needed.
Thanks & Regards, Kyoto