VB.NET
VB.NET
AbuseIPDB Check Endpoint
See more _Miscellaneous_ Examples
The check endpoint accepts a single IP address (v4 or v6). Optionally you may set the maxAgeInDays parameter to only return reports within the last x amount of days.Chilkat VB.NET Downloads
Dim success As Boolean = False
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New Chilkat.Http
' Implements the following CURL command:
' curl -G https://api.abuseipdb.com/api/v2/check \
' --data-urlencode "ipAddress=118.25.6.39" \
' -d maxAgeInDays=90 \
' -d verbose \
' -H "Key: $YOUR_API_KEY" \
' -H "Accept: application/json"
' Use the following online tool to generate HTTP code from a CURL command
' Convert a cURL Command to HTTP Source Code
Dim req As New Chilkat.HttpRequest
req.HttpVerb = "GET"
req.Path = "/api/v2/check"
req.ContentType = "application/x-www-form-urlencoded"
req.AddParam("maxAgeInDays","90")
req.AddParam("verbose","")
req.AddParam("ipAddress","118.25.6.39")
req.AddHeader("Key","$YOUR_API_KEY")
req.AddHeader("Accept","application/json")
Dim resp As New Chilkat.HttpResponse
success = http.HttpSReq("api.abuseipdb.com",443,True,req,resp)
If (success = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If
Dim jResp As New Chilkat.JsonObject
jResp.Load(resp.BodyStr)
jResp.EmitCompact = False
Debug.WriteLine("Response Body:")
Debug.WriteLine(jResp.Emit())
Dim respStatusCode As Integer = resp.StatusCode
Debug.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
Debug.WriteLine("Response Header:")
Debug.WriteLine(resp.Header)
Debug.WriteLine("Failed.")
Exit Sub
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "data": {
' "ipAddress": "118.25.6.39",
' "isPublic": true,
' "ipVersion": 4,
' "isWhitelisted": false,
' "abuseConfidenceScore": 1,
' "countryCode": "CN",
' "usageType": "Data Center\/Web Hosting\/Transit",
' "isp": "Tencent Cloud Computing (Beijing) Co. Ltd",
' "domain": "tencent.com",
' "hostnames": [
' ],
' "countryName": "China",
' "totalReports": 2,
' "numDistinctUsers": 1,
' "lastReportedAt": "2021-04-03T18:55:00+00:00",
' "reports": [
' {
' "reportedAt": "2021-03-10T10:07:53+00:00",
' "comment": "SSH login attempts with user root.",
' "categories": [
' 18,
' 22
' ],
' "reporterId": 54484,
' "reporterCountryCode": "CN",
' "reporterCountryName": "China"
' },
' {
' "reportedAt": "2021-03-09T09:47:57+00:00",
' "comment": "SSH login attempts with user root.",
' "categories": [
' 18,
' 22
' ],
' "reporterId": 54484,
' "reporterCountryCode": "CN",
' "reporterCountryName": "China"
' }
' ]
' }
' }
' Sample code for parsing the JSON response...
' Use the following online tool to generate parsing code from sample JSON:
' Generate Parsing Code from JSON
Dim reportedAt As String
Dim comment As String
Dim reporterId As Integer
Dim reporterCountryCode As String
Dim reporterCountryName As String
Dim j As Integer
Dim count_j As Integer
Dim intVal As Integer
Dim dataIpAddress As String = jResp.StringOf("data.ipAddress")
Dim dataIsPublic As Boolean = jResp.BoolOf("data.isPublic")
Dim dataIpVersion As Integer = jResp.IntOf("data.ipVersion")
Dim dataIsWhitelisted As Boolean = jResp.BoolOf("data.isWhitelisted")
Dim dataAbuseConfidenceScore As Integer = jResp.IntOf("data.abuseConfidenceScore")
Dim dataCountryCode As String = jResp.StringOf("data.countryCode")
Dim dataUsageType As String = jResp.StringOf("data.usageType")
Dim dataIsp As String = jResp.StringOf("data.isp")
Dim dataDomain As String = jResp.StringOf("data.domain")
Dim dataCountryName As String = jResp.StringOf("data.countryName")
Dim dataTotalReports As Integer = jResp.IntOf("data.totalReports")
Dim dataNumDistinctUsers As Integer = jResp.IntOf("data.numDistinctUsers")
Dim dataLastReportedAt As String = jResp.StringOf("data.lastReportedAt")
Dim i As Integer = 0
Dim count_i As Integer = jResp.SizeOfArray("data.hostnames")
While i < count_i
jResp.I = i
i = i + 1
End While
i = 0
count_i = jResp.SizeOfArray("data.reports")
While i < count_i
jResp.I = i
reportedAt = jResp.StringOf("data.reports[i].reportedAt")
comment = jResp.StringOf("data.reports[i].comment")
reporterId = jResp.IntOf("data.reports[i].reporterId")
reporterCountryCode = jResp.StringOf("data.reports[i].reporterCountryCode")
reporterCountryName = jResp.StringOf("data.reports[i].reporterCountryName")
j = 0
count_j = jResp.SizeOfArray("data.reports[i].categories")
While j < count_j
jResp.J = j
intVal = jResp.IntOf("data.reports[i].categories[j]")
j = j + 1
End While
i = i + 1
End While