4.2 Čitanje podataka s VBA

Dohvaćanje podataka tablice putem REST API-ja.

Potpuni primjer

Sub UcitajKlijente()
    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 "Greška: " & http.Status
    End If
End Sub

S filterom

url = "http://localhost:5000/api/v1/dsn/demo/tables/Customers" & _
      "?$filter=Country eq 'Germany'&$orderby=Name"

URL kodiranje

Posebni znakovi u filteru moraju biti kodirani:

filter = Application.EncodeURL("Country eq 'Germany'")
Zuletzt geändert: 29.01.2026. u 23:27