Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

C# Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Amazon Rekognition
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
ETrade
Egypt ITIDA
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
MedTunnel
MercadoLibre

Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yousign
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(C#) AbuseIPDB Check Endpoint

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.

For more information, see https://docs.abuseipdb.com/?shell#check-endpoint

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

// 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

Chilkat.HttpRequest req = 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");

Chilkat.HttpResponse resp = http.SynchronousRequest("api.abuseipdb.com",443,true,req);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Chilkat.JsonObject jResp = new Chilkat.JsonObject();
jResp.Load(resp.BodyStr);
jResp.EmitCompact = false;

Debug.WriteLine("Response Body:");
Debug.WriteLine(jResp.Emit());

int respStatusCode = resp.StatusCode;
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
if (respStatusCode >= 400) {
    Debug.WriteLine("Response Header:");
    Debug.WriteLine(resp.Header);
    Debug.WriteLine("Failed.");

    return;
}

// 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

string reportedAt;
string comment;
int reporterId;
string reporterCountryCode;
string reporterCountryName;
int j;
int count_j;
int intVal;

string dataIpAddress = jResp.StringOf("data.ipAddress");
bool dataIsPublic = jResp.BoolOf("data.isPublic");
int dataIpVersion = jResp.IntOf("data.ipVersion");
bool dataIsWhitelisted = jResp.BoolOf("data.isWhitelisted");
int dataAbuseConfidenceScore = jResp.IntOf("data.abuseConfidenceScore");
string dataCountryCode = jResp.StringOf("data.countryCode");
string dataUsageType = jResp.StringOf("data.usageType");
string dataIsp = jResp.StringOf("data.isp");
string dataDomain = jResp.StringOf("data.domain");
string dataCountryName = jResp.StringOf("data.countryName");
int dataTotalReports = jResp.IntOf("data.totalReports");
int dataNumDistinctUsers = jResp.IntOf("data.numDistinctUsers");
string dataLastReportedAt = jResp.StringOf("data.lastReportedAt");
int i = 0;
int count_i = jResp.SizeOfArray("data.hostnames");
while (i < count_i) {
    jResp.I = i;
    i = i + 1;
}

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;
    }

    i = i + 1;
}


 

© 2000-2021 Chilkat Software, Inc. All Rights Reserved.