Hi
A slightly different problem for you. This function works on my laptop, both at home and on the corporate network. On the desktop (corporate network) however it fails at .send. When I test the url in chrome, it retrieves the data. Any suggestions as to how our IT dept have achieved this? (as brilliant as they are, they are not familiar with VBA and don't know what to do on their side to allow it to work). Any help with this would be much appreciated. Thank you
A slightly different problem for you. This function works on my laptop, both at home and on the corporate network. On the desktop (corporate network) however it fails at .send. When I test the url in chrome, it retrieves the data. Any suggestions as to how our IT dept have achieved this? (as brilliant as they are, they are not familiar with VBA and don't know what to do on their side to allow it to work). Any help with this would be much appreciated. Thank you
VBA Code:
Function GetAPI(Credent As String, APIurl As String) As Variant
' Credent is the API username and pwd in base64
' IT have restricted use of the MSXML2.ServerXMLHTTP60 inside their network
' Have replaced this with the standard version (they assure me caching is not a problem)
' This works at home, not on the VPN nor in the office
' Dim AcousticReQuest As MSXML2.ServerXMLHTTP60
' Set AcousticReQuest = New ServerXMLHTTP60
'' this works in the office on the laptop, but not on the desktop
Dim AcousticReQuest As MSXML2.XMLHTTP60
Set AcousticReQuest = New XMLHTTP60
' getting the API
' to prevent caching add a time variable to the URL sush as [ "&cb=" timer()*100 ]
' this should prevent caching from interfering with the refresh
APIurl = APIurl & "&cb=" & Timer() * 100
With AcousticReQuest
.Open "GET", APIurl, False
.setRequestHeader "Accept", "text/json"
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Authorization", "Basic " & Credent
.send
GetAPI = .responseText
OutPutWS.Cells(1, 1) = .responseText
OutPutWS.Cells(1, 2) = Len(.responseText)
.abort
End With
End Function