I have a question. I have a site and I want to pull data through this website. I wrote a VBA code but it seems it always return empty even though there are data. Here is the code;
Sub dataxx()
Dim request As New WinHttpRequest
request.Open "Get", "https://api.ibb.gov.tr/ispark/ParkDetay?id=45"
request.Send
If request.Status <> 200 Then
MsgBox request.ResponseText
Exit Sub
End If
Dim response As Variant
Set response = JsonConverter.ParseJSON(request.ResponseText)
Dim parkArray() As String
ReDim parkArray(0 To 0)
On Error Resume Next
Dim locationName As String
locationName = response("locationName")
Dim parkID As Integer
parkID = response("parkID")
Dim parkName As String
parkName = response("parkName")
Dim lat As Double
lat = response("lat")
Dim lng As Double
lng = response("lng")
Dim capacity As Integer
capacity = response("capacity")
Dim emptyCapacity As Integer
emptyCapacity = response("emptyCapacity")
Dim updateDate As Date
updateDate = response("updateDate")
Dim workHours As String
workHours = response("workHours")
Dim parkType As String
parkType = response("parkType")
Dim freeTime As Integer
freeTime = response("freeTime")
Dim monthlyFee As Double
monthlyFee = response("monthlyFee")
Dim tariff As String
tariff = response("tariff")
Dim district As String
district = response("district")
Dim address As String
address = response("address")
Dim areaPolygon As String
areaPolygon = response("areaPolygon")
parkArray(15) = Array(locationName, parkID, parkName, lat, lng, capacity, emptyCapacity, updateDate, workHours, parkType, freeTime, monthlyFee, tariff, district, address, areaPolygon)
End Sub
What do you guys think of it? What is wrong with the code. If i didn't put "On Error Resume Next" then i get an error "Invalid procedure call or argument". Can anyone help me please with it?