based:
how to use this api in vb6.?
for example, get the list of CAP
note:
i just have a key token
how to use this api in vb6.?
for example, get the list of CAP
note:
i just have a key token
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[COLOR=blue]Private Sub RestExample()
Dim APICall As String
Dim Query As String
Dim strKey As String
Dim myXML As New MSXML2.DOMDocument60
Dim nodes As IXMLDOMSelection
APICall = "[URL unfurl="true"]https://test.cap.openapi.it/cerca_comuni"[/URL]
Query = "?comune=Roma" [COLOR=green]' use Rome as an example[/color]
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", APICall & Query, False
.setRequestHeader "Authorization", "Bearer <your_token_goes_here>"
.send
JSONDecode Replace(.responseText, "data", "info") [COLOR=green]' avoid the trap that data is a reserved word in VB[/color]
End With
End Sub
Sub JSONDecode(JSONString)
Dim oJSON, mydata
With CreateObject("ScriptControl")
.Language = "JScript"
Set oJSON = .Eval("(" + JSONString + ")")
For Each mydata In oJSON.info.result
Debug.Print "Comune: " & mydata.comune & ", " & mydata.istat
Next
End With
End Sub[/color]