Loquate API

Ashen

New Member
Joined
Aug 4, 2016
Messages
12
I have a file of data already prepared for running through the API here

and i would REALLY like to do this using VBA, but i have to be honest, it could be because its late and i am tired, but i'm struggling to see how i can send this file [C:\Users\XXXX\Loquate.txt ] to the data cleansing service, and get the results back to either a text file or excel file.... I have a key, and am reasonable with VBA, but none of the googling i have done is giving me a clue....
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,703
Untested, etc. but try this, assuming your Loquate.txt file is in the format shown in the example request:
VBA Code:
Public Sub API_request()

    Dim FSO As Object, httpReq As Object, ts As Object
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set httpReq = CreateObject("MSXML2.XMLHTTP")
    With httpReq
        .Open "POST", "https://api.addressy.com/Cleansing/International/Batch/v1.00/json4.ws", False
        .setRequestHeader "Content-Type", "application/json"
        .send (FSO.OpenTextFile("C:\Users\XXXX\Loquate.txt").ReadAll)
        Set ts = FSO.CreateTextFile("C:\Users\XXXX\Results.txt")
        ts.Write .responseText
        ts.Close
    End With

End Sub
 

Ashen

New Member
Joined
Aug 4, 2016
Messages
12
Untested, etc. but try this, assuming your Loquate.txt file is in the format shown in the example request:
VBA Code:
Public Sub API_request()

    Dim FSO As Object, httpReq As Object, ts As Object
   
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set httpReq = CreateObject("MSXML2.XMLHTTP")
    With httpReq
        .Open "POST", "https://api.addressy.com/Cleansing/International/Batch/v1.00/json4.ws", False
        .setRequestHeader "Content-Type", "application/json"
        .send (FSO.OpenTextFile("C:\Users\XXXX\Loquate.txt").ReadAll)
        Set ts = FSO.CreateTextFile("C:\Users\XXXX\Results.txt")
        ts.Write .responseText
        ts.Close
    End With

End Sub


wow - that looks amazing - thank you so much, just need to check my results - but seriously THANK YOU!
 

Watch MrExcel Video

Forum statistics

Threads
1,126,989
Messages
5,622,020
Members
415,874
Latest member
JockPC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top