Hey guys. 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")
Debug.Print locationName
Dim parkID As Integer
parkID = response("parkID")
Debug.Print parkID
Dim parkName As String
parkName = response("parkName")
Debug.Print parkName
Dim lat As Double
lat = response("lat")
Debug.Print lat
Dim lng As Double
lng = response("lng")
Debug.Print lng
Dim capacity As Integer
capacity = response("capacity")
Debug.Print capacity
Dim emptyCapacity As Integer
emptyCapacity = response("emptyCapacity")
Debug.Print emptyCapacity
Dim updateDate As Date
updateDate = response("updateDate")
Debug.Print updateDate
Dim workHours As String
workHours = response("workHours")
Debug.Print workHours
Dim parkType As String
parkType = response("parkType")
Debug.Print parkType
Dim freeTime As Integer
freeTime = response("freeTime")
Debug.Print freeTime
Dim monthlyFee As Double
monthlyFee = response("monthlyFee")
Debug.Print monthlyFee
Dim tariff As String
tariff = response("tariff")
Debug.Print tariff
Dim district As String
district = response("district")
Debug.Print district
Dim address As String
address = response("address")
Debug.Print address
Dim areaPolygon As String
areaPolygon = response("areaPolygon")
Debug.Print areaPolygon
'parkArray(15) = Array(locationName, parkID, parkName, lat, lng, capacity, emptyCapacity, updateDate, workHours, parkType, freeTime, monthlyFee, tariff, district, address, areaPolygon)
'Debug.Print Join(parkArray, "parkID")
End Sub
For example when I watch line 50 it should return "Teşvikiye Cami 1" but it just returns empty and error occurs "Invalid procedure call or argument". Anyone can help me with that?
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")
Debug.Print locationName
Dim parkID As Integer
parkID = response("parkID")
Debug.Print parkID
Dim parkName As String
parkName = response("parkName")
Debug.Print parkName
Dim lat As Double
lat = response("lat")
Debug.Print lat
Dim lng As Double
lng = response("lng")
Debug.Print lng
Dim capacity As Integer
capacity = response("capacity")
Debug.Print capacity
Dim emptyCapacity As Integer
emptyCapacity = response("emptyCapacity")
Debug.Print emptyCapacity
Dim updateDate As Date
updateDate = response("updateDate")
Debug.Print updateDate
Dim workHours As String
workHours = response("workHours")
Debug.Print workHours
Dim parkType As String
parkType = response("parkType")
Debug.Print parkType
Dim freeTime As Integer
freeTime = response("freeTime")
Debug.Print freeTime
Dim monthlyFee As Double
monthlyFee = response("monthlyFee")
Debug.Print monthlyFee
Dim tariff As String
tariff = response("tariff")
Debug.Print tariff
Dim district As String
district = response("district")
Debug.Print district
Dim address As String
address = response("address")
Debug.Print address
Dim areaPolygon As String
areaPolygon = response("areaPolygon")
Debug.Print areaPolygon
'parkArray(15) = Array(locationName, parkID, parkName, lat, lng, capacity, emptyCapacity, updateDate, workHours, parkType, freeTime, monthlyFee, tariff, district, address, areaPolygon)
'Debug.Print Join(parkArray, "parkID")
End Sub
For example when I watch line 50 it should return "Teşvikiye Cami 1" but it just returns empty and error occurs "Invalid procedure call or argument". Anyone can help me with that?