Inhaltsverzeichnis
4.2 Branje podatkov z VBA
Pridobivanje tabelarnih podatkov preko REST API.
Popoln primer
Sub NaloziStranke() Dim http As Object Dim url As String Dim json As String url = "http://localhost:5000/api/v1/dsn/demo/tables/Customers?$top=10" Set http = CreateObject("MSXML2.XMLHTTP") http.Open "GET", url, False http.setRequestHeader "Accept", "application/json" http.send If http.Status = 200 Then json = http.responseText Debug.Print json Else MsgBox "Napaka: " & http.Status End If End Sub
S filtrom
url = "http://localhost:5000/api/v1/dsn/demo/tables/Customers" & _ "?$filter=Country eq 'Germany'&$orderby=Name"
URL kodiranje
Posebni znaki v filtru morajo biti kodirani:
filter = Application.EncodeURL("Country eq 'Germany'")
Zuletzt geändert: dne 29.01.2026 ob 23:25