.Net
Official C# client library for the ipdata API. To report bugs or submit feature suggestions create an issue at https://github.com/ipdata/dotnet/issues/new.

Installation

NuGet package install using package manager:
1
Install-Package IpData -Version 1.0.0
Copied!
NuGet package install using .NET CLI:
1
dotnet add package IpData --version 1.0.0
Copied!

Basic Usage

1
vvar client = new IpDataClient("API_KEY");
2
3
// Get IP data from my IP
4
var myIpInfo = await client.Lookup();
5
Console.WriteLine(quot;Country name for {myIpInfo.Ip} is {myIpInfo.CountryName}");
6
7
// Get IP data from IP
8
var ipInfo = await client.Lookup("8.8.8.8");
9
Console.WriteLine(quot;Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
10
11
// Get single field from IP
12
var countryName = await client.Lookup("8.8.8.8", x => x.CountryName);
13
Console.WriteLine(quot;Country name for 8.8.8.8 is {countryName}");
14
15
// Get multiple fields from IP
16
var geolocation = await client.Lookup("8.8.8.8", x => x.Latitude, x => x.Longitude);
17
Console.WriteLine(quot;Geolocation for 8.8.8.8 is lat: {geolocation.Latitude} long: {geolocation.Longitude}");
Copied!

Bulk Lookup

1
var client = new IpDataClient("API_KEY");
2
3
var ipInfoList = await client.Lookup(new string[] { "1.1.1.1", "2.2.2.2", "3.3.3.3" });
4
foreach (var ipInfo in ipInfoList)
5
{
6
Console.WriteLine(quot;Country name for {ipInfo.Ip} is {ipInfo.CountryName}");
7
}
Copied!

Carrier Lookup

1
var client = new IpDataClient("API_KEY");
2
3
var carrierInfo = await client.Carrier("69.78.70.144");
4
Console.WriteLine(quot;Carrier name: {carrierInfo.Name}");
Copied!

ASN

1
var client = new IpDataClient("API_KEY");
2
3
var asnInfo = await client.Asn("69.78.70.144");
4
Console.WriteLine(quot;ASN name: {asnInfo.Name}");
Copied!

Timezone

1
var client = new IpDataClient("API_KEY");
2
3
var timezoneInfo = await client.TimeZone("69.78.70.144");
4
Console.WriteLine(quot;TimeZone name: {timezoneInfo.Name}");
Copied!

Currency

1
var client = new IpDataClient("API_KEY");
2
3
var currencyInfo = await client.Currency("69.78.70.144");
4
Console.WriteLine(quot;Currency name: {currencyInfo.Name}");
Copied!

Threat

1
var client = new IpDataClient("API_KEY");
2
3
var threatInfo = await client.Threat("69.78.70.144");
4
Console.WriteLine(quot;Threat is Tor: {threatInfo.IsTor}");
Copied!
Last modified 1yr ago