HTTP - JSON Request



Using MSXML2.XMLHTTP60

Reference - Microsoft XML v6.0
Supports proxy and server credentials

Sub Request() 
Dim xmlhttp As New MSXML2.XMLHTTP60
Dim myResponse As String

    sDownloadDate = VBA.Format(sDownloadDate, "yyyy-mm-dd") 
    
    Call xmlhttp.Open("GET", modConstants.g_sURL_PREFIX & modConstants.g_sURL_SUFFIX_COMBINEDINFO & sDownloadDate, False)
    xmlhttp.send
    myResponse = xmlhttp.responseText
End Sub


Using WinHttp.WinHttpRequest

Reference - Microsoft WinHTTP Services v5.1
Supports proxy credentials

Sub Request() 
Dim xmlhttp As WinHttp.WinHttpRequest

    Set xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
    
    xmlhttp.Open "GET", _
    "https://bettersolutions.com/RestService"

    xmlhttp.SetAutoLogonPolicy (WinHttp.AutoLogonPolicy_Always)

    xmlhttp.Send

    MsgBox xmlhttp.ResponseText
End Sub




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext