Skip to content

Commit 92c6828

Browse files
committed
Added Abuse Contact API and Astronomy API New Fields
1 parent a9c6c97 commit 92c6828

File tree

181 files changed

+3947
-3020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+3947
-3020
lines changed

README.md

Lines changed: 125 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Ipgeolocation provides a set of APIs to make ip based decisions.
88
## Table of Contents
99

1010
1. [Installation](#installation)
11-
- [Maven](#maven)
12-
- [Gradle](#gradle)
11+
- [Maven](#using-maven)
12+
- [Gradle](#using-gradle)
1313
- [Manual Installation](#manual-installation)
1414
2. [Authentication Setup](#authentication-setup)
15-
15+
3. [API Endpoints](#api-endpoints)
1616
3. [IP Geolocation Examples](#ip-geolocation-examples)
1717
- [1. Basic Plan Examples](#1-basic-plan-examples)
1818
- [2. Standard Plan Examples](#2-standard-plan-examples)
@@ -121,6 +121,26 @@ Ensure that your API key is securely stored and not exposed in public repositori
121121

122122
---
123123

124+
# API Endpoints
125+
126+
All URIs are relative to *https://api.ipgeolocation.io/v2*
127+
128+
Class | Method | HTTP request | Description
129+
------------ |-----------------------------------------------------------------------------------| ------------- | -------------
130+
*ASNLookupAPI* | [**getAsnDetails**](docs/ASNLookupAPI.md#getasndetails) | **GET** /asn | Get details of any ASN number or associated IP address
131+
*AbuseContactAPI* | [**getAbuseContactInfo**](docs/AbuseContactAPI.md#getabusecontactinfo) | **GET** /abuse | Retrieve abuse reporting contact information for a given IP address
132+
*AstronomyAPI* | [**getAstronomy**](docs/AstronomyAPI.md#getastronomydetails) | **GET** /astronomy | Get sunrise, sunset, moonrise, moonset, and related data for a location
133+
*IPGeolocationAPI* | [**getBulkIPGeolocation**](docs/IPGeolocationAPI.md#getbulkipgeolocation) | **POST** /ipgeo-bulk | Get geolocation data for multiple IP addresses in a single API request
134+
*IPGeolocationAPI* | [**getIPGeolocation**](docs/IPGeolocationAPI.md#getipgeolocation) | **GET** /ipgeo | Get geolocation data for a single IP address
135+
*IPSecurityAPI* | [**getBulkIPSecurity**](docs/IPSecurityAPI.md#getbulkipsecurity) | **POST** /security-bulk | Retrieve security threat intelligence for multiple IPs
136+
*IPSecurityAPI* | [**getIPSecurity**](docs/IPSecurityAPI.md#getipsecurity) | **GET** /security | Retrieve security information (VPN, TOR, proxy, etc.) for a single IP
137+
*TimeConversionAPI* | [**convertTimezone**](docs/TimezoneConversionAPI.md#converttimezone) | **GET** /timezone/convert | Convert time between two specified timezones
138+
*TimezoneAPI* | [**getTimezone**](docs/TimezoneAPI.md#gettimezone) | **GET** /timezone | Timezone information details
139+
*UserAgentAPI* | [**getUserAgent**](docs/Api/UserAgentAPI.md#getuseragentdetails) | **GET** /user-agent | Get details of user-agent
140+
*UserAgentAPI* | [**getBulkUserAgent**](docs/UserAgentAPI.md#getbulkuseragent) | **POST** /user-agent-bulk | Handle multiple user-agent string lookups
141+
*UserAgentAPI* | [**getUserAgentOfCustomString**](docs/UserAgentAPI.md#getuseragentofcustomstring) | **POST** /user-agent | Handle single User-Agent string
142+
---
143+
124144
# Example Usage
125145

126146
## IP Geolocation Examples
@@ -151,7 +171,7 @@ For complete details, refer to the official documentation: [IP Geolocation API D
151171

152172
The `ip` parameter in the SDK can accept any valid IPv4 address, IPv6 address, or domain name. If the `ip()` method is not used or the parameter is omitted, the API will return information about the public IP address of the device or server where the SDK is executed.
153173

154-
### 1. Basic Plan Examples
174+
### 1. Developer (Free) Plan Examples
155175

156176
#### Default Fields
157177

@@ -403,10 +423,10 @@ class GeolocationResponse {
403423
}
404424
}
405425
userAgent: class UserAgentData {
406-
userAgentString: OpenAPI-Generator/1.0.0/java
407-
name: OpenAPI-Generator
426+
userAgentString: IPGeolocation/2.0.0/java
427+
name: IPGeolocation Java SDK
408428
type: Special
409-
version: 1.0.0
429+
version: 2.0.0
410430
versionMajor: 1
411431
device: class UserAgentDataDevice {
412432
name: Unknown
@@ -696,10 +716,10 @@ class SecurityAPIResponse {
696716
}
697717
}
698718
userAgent: class UserAgentData {
699-
userAgentString: OpenAPI-Generator/1.0.0/java
700-
name: OpenAPI-Generator
719+
userAgentString: IPGeolocation/2.0.0/java
720+
name: IPGeolocation Java SDK
701721
type: Special
702-
version: 1.0.0
722+
version: 2.0.0
703723
versionMajor: 1
704724
device: class UserAgentDataDevice {
705725
name: Unknown
@@ -1400,10 +1420,10 @@ For more details, refer to official documentation: [Timezone Converter API](http
14001420
### Convert Current Time from One Timezone to Another
14011421

14021422
```java
1403-
import io.ipgeolocation.sdk.api.TimezoneAPI;
1423+
import io.ipgeolocation.sdk.api.TimezoneConversionAPI;
14041424
import io.ipgeolocation.sdk.model.TimezoneConversionResponse;
14051425

1406-
TimezoneAPI api = new TimezoneAPI(client);
1426+
TimezoneConversionAPI api = new TimezoneConversionAPI(client);
14071427

14081428
TimezoneConversionResponse response = api.convertTimezone()
14091429
.from("America/New_York")
@@ -1414,7 +1434,7 @@ System.out.println(response);
14141434
```
14151435
Sample Response
14161436
```
1417-
class TimeConversionResponse {
1437+
class TimezoneConversionResponse {
14181438
originalTime: 2024-12-08 11:00
14191439
convertedTime: 2024-12-09 01:00:00
14201440
diffHour: 14.0
@@ -1742,6 +1762,93 @@ class AstronomyResponse {
17421762
}
17431763
}
17441764
```
1765+
## Abuse Contact API Examples
1766+
This section demonstrates how to use the `getAbuseContactInfo()` method of the AbuseContact API. This API helps security teams, hosting providers, and compliance professionals quickly identify the correct abuse reporting contacts for any IPv4 or IPv6 address. You can retrieve data like the responsible organization, role, contact emails, phone numbers, and address to take appropriate mitigation action against abusive or malicious activity.
1767+
> **Note**: Abuse Contact API is only available in Advanced Plan
1768+
1769+
Refer to the official [Abuse Contact API documentation](https://ipgeolocation.io/ip-abuse-contact-api.html#documentation-overview) for details on all available fields.
1770+
### Lookup Abuse Contact by IP
1771+
```java
1772+
import io.ipgeolocation.sdk.api.AbuseContactAPI;
1773+
import io.ipgeolocation.sdk.model.AbuseResponse;
1774+
1775+
AbuseContactAPI api = new AbuseContactAPI(client);
1776+
1777+
AbuseResponse response = api.getAbuseContactInfo()
1778+
.ip("1.0.0.0")
1779+
.execute();
1780+
1781+
System.out.println(response);
1782+
```
1783+
Sample Response:
1784+
```
1785+
class AbuseResponse {
1786+
ip: 1.0.0.0
1787+
abuse: class Abuse {
1788+
route: 1.0.0.0/24
1789+
country: AU
1790+
handle: IRT-APNICRANDNET-AU
1791+
name: IRT-APNICRANDNET-AU
1792+
organization:
1793+
role: abuse
1794+
kind: group
1795+
address: PO Box 3646
1796+
South Brisbane, QLD 4101
1797+
Australia
1798+
1799+
phoneNumbers: [+61 7 3858 3100]
1800+
}
1801+
}
1802+
```
1803+
1804+
### Lookup Abuse Contact with Specific Fields
1805+
```java
1806+
AbuseResponse response = api.getAbuseContactInfo()
1807+
.ip("1.2.3.4")
1808+
.fields("abuse.role,abuse.emails")
1809+
.execute();
1810+
1811+
System.out.println(response);
1812+
```
1813+
Sample Response:
1814+
```
1815+
class AbuseResponse {
1816+
ip: 1.2.3.4
1817+
abuse: class Abuse {
1818+
role: abuse
1819+
1820+
}
1821+
}
1822+
```
1823+
### Lookup Abuse Contact while Excluding Fields
1824+
```java
1825+
AbuseResponse response = api.getAbuseContactInfo()
1826+
.ip("9.9.9.9")
1827+
.excludes("abuse.handle,abuse.emails")
1828+
.execute();
1829+
1830+
System.out.println(response);
1831+
```
1832+
Sample Response:
1833+
```
1834+
class AbuseResponse {
1835+
ip: 9.9.9.9
1836+
abuse: class Abuse {
1837+
route: 9.9.9.0/24
1838+
country:
1839+
name: Quad9 Abuse
1840+
organization: Quad9 Abuse
1841+
role: abuse
1842+
kind: group
1843+
address: 1442 A Walnut Street Ste 501
1844+
Berkeley
1845+
CA
1846+
94709
1847+
United States
1848+
phoneNumbers: [+1-415-831-3129]
1849+
}
1850+
}
1851+
```
17451852

17461853

17471854
## Documentation for Models
@@ -1750,7 +1857,11 @@ class AstronomyResponse {
17501857
- [ASNResponse](docs/ASNResponse.md)
17511858
- [ASNDetails](docs/ASNDetails.md)
17521859
- [Abuse](docs/Abuse.md)
1860+
- [AbuseResponse](docs/AbuseResponse.md)
17531861
- [Astronomy](docs/Astronomy.md)
1862+
- [AstronomyEvening](docs/AstronomyEvening.md)
1863+
- [AstronomyLocation](docs/AstronomyLocation.md)
1864+
- [AstronomyMorning](docs/AstronomyMorning.md)
17541865
- [AstronomyResponse](docs/AstronomyResponse.md)
17551866
- [CountryMetadata](docs/CountryMetadata.md)
17561867
- [Currency](docs/Currency.md)
@@ -1769,7 +1880,7 @@ class AstronomyResponse {
17691880
- [Security](docs/Security.md)
17701881
- [SecurityAPIResponse](docs/SecurityAPIResponse.md)
17711882
- [BulkSecurityResponse](docs/BulkSecurityResponse.md)
1772-
- [TimeConversionResponse](docs/TimeConversionResponse.md)
1883+
- [TimeConversionResponse](docs/TimezoneConversionResponse.md)
17731884
- [TimeZone](docs/TimeZone.md)
17741885
- [TimezoneResponse](docs/TimezoneResponse.md)
17751886
- [TimezoneDstEnd](docs/TimezoneDstEnd.md)

docs/AsnLookupApi.md renamed to docs/ASNLookupAPI.md

Lines changed: 13 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,18 @@
1-
# AsnLookupApi
1+
# ASNLookupAPI
22

33
All URIs are relative to *https://api.ipgeolocation.io/v2*
44

5-
| Method | HTTP request | Description |
6-
|------------- | ------------- | -------------|
7-
| [**asnGet**](AsnLookupApi.md#asnGet) | **GET** /asn | |
8-
9-
10-
<a id="asnGet"></a>
11-
# **asnGet**
12-
> ASNResponse asnGet().ip(ip).asn(asn).include(include).excludes(excludes).fields(fields).execute();
13-
14-
15-
16-
ASN API provides comprehensive details for an ASN including the as name, organization name, the country of registration, associated domain, and its type (ISP, host provider, or business). The API also shows the allocation date of provided ASN and if it is currently allocated or not. It also contains the routing information including peering, upstreams, and downstreams to help understand the relationship between different ASNs. Example Use Cases: - Looking up ASN information for an IP address (e.g., &#x60;GET /asn?ip&#x3D;8.8.8.8&#x60;) - Retrieving ASN information for a specific ASN number (e.g., &#x60;GET /asn?asn&#x3D;12345&#x60;) - Getting peering relationships for an ASN (e.g., &#x60;GET /asn?asn&#x3D;12345&amp;include&#x3D;peers&#x60;)
17-
18-
### Example
19-
20-
```java
21-
// Import classes:
22-
23-
import invoker.io.ipgeolocation.sdk.ApiClient;
24-
import invoker.io.ipgeolocation.sdk.ApiException;
25-
import invoker.io.ipgeolocation.sdk.Configuration;
26-
import io.ipgeolocation.sdk.api.AsnLookupAPI;
27-
import io.ipgeolocation.sdk.api.AsnLookupApi;
28-
import io.ipgeolocation.sdk.invoker.auth.ApiKeyAuth;
29-
30-
public class Example {
31-
public static void main(String[] args) {
32-
ApiClient defaultClient = Configuration.getDefaultApiClient();
33-
defaultClient.setBasePath("https://api.ipgeolocation.io/v2");
34-
35-
// Configure API key authorization: ApiKeyAuth
36-
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
37-
ApiKeyAuth.setApiKey("YOUR API KEY");
38-
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
39-
//ApiKeyAuth.setApiKeyPrefix("Token");
40-
41-
AsnLookupAPI apiInstance = new AsnLookupAPI(defaultClient);
42-
String ip = "8.8.8.8"; // String | query parameter 'ip'.
43-
Integer asn = 1; // Integer | query paramter 'asn'.
44-
String include = "peers"; // String | This parameter can have four options: a) peers b) downstreams c) upstreams d) routes e) whois_response. You may add any of them in comma-separated way. In order to get the ASN details with peering data, pass peers string in the include parameter like mentioned below.
45-
String excludes = "asn.date_allocated,asn.allocation_status"; // String | You can exclude fields from the response according to you requirement with the exception of ip field. For example, you want to remove date_allocated and allocation_status from api response, you can put the keys in excludes parameter like this.
46-
String fields = "asn.organization,asn.country,asn.downstreams"; // String | You can filter out only those fields which you want to see in the response by using the fields parameter. To retrieve only the AS organization, its country and downstreams in api response, you can put the keys in fields parameter like this. API will combine these fields with the default ASN response. Note: Parameters `peers, downstreams, upstreams, routes, whois_response` can be used in both `include` , and `fields`. If you use include and fields at the same time, fields parameter will be considered only.
47-
try {
48-
ASNResponse result = apiInstance.getAsnDetails()
49-
.ip(ip)
50-
.asn(asn)
51-
.include(include)
52-
.excludes(excludes)
53-
.fields(fields)
54-
.execute();
55-
System.out.println(result);
56-
} catch (ApiException e) {
57-
System.err.println("Exception when calling AsnLookupApi#asnGet");
58-
System.err.println("Status code: " + e.getCode());
59-
System.err.println("Reason: " + e.getResponseBody());
60-
System.err.println("Response headers: " + e.getResponseHeaders());
61-
e.printStackTrace();
62-
}
63-
}
64-
}
65-
```
5+
| Method | HTTP request | Description |
6+
|----------------------------------------------------| ------------- | -------------|
7+
| [**getAsnDetails**](ASNLookupAPI.md#getasndetails) | **GET** /asn | |
8+
9+
10+
# **getAsnDetails**
11+
> ASNResponse getAsnDetails().ip(ip).asn(asn).include(include).excludes(excludes).fields(fields).execute();
12+
13+
14+
15+
ASN API provides comprehensive details for an ASN including the as name, organization name, the country of registration, associated domain, and its type (ISP, host provider, or business). The API also shows the allocation date of provided ASN and if it is currently allocated or not. It also contains the routing information including peering, upstreams, and downstreams to help understand the relationship between different ASNs. Example Use Cases: - Looking up ASN information for an IP address (e.g., &#x60;GET /asn?ip&#x3D;8.8.8.8&#x60;) - Retrieving ASN information for a specific ASN number (e.g., &#x60;GET /asn?asn&#x3D;12345&#x60;) - Getting peering relationships for an ASN (e.g., &#x60;GET /asn?asn&#x3D;12345&amp;include&#x3D;peers&#x60;)
6616

6717
### Parameters
6818

@@ -80,7 +30,7 @@ public class Example {
8030

8131
### Authorization
8232

83-
[ApiKeyAuth](../README.md#ApiKeyAuth)
33+
[ApiKeyAuth](../README.md#authentication-setup)
8434

8535
### HTTP request headers
8636

docs/ASNResponseXMLAsn.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/AbuseContactAPI.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# AbuseContactAPI
2+
3+
All URIs are relative to *https://api.ipgeolocation.io/v2*
4+
5+
| Method | HTTP request | Description |
6+
|-------------------------------------------------------------------| ------------- | -------------|
7+
| [**getAbuseContactInfo**](AbuseContactAPI.md#getabusecontactinfo) | **GET** /abuse | |
8+
9+
10+
11+
# **getAbuseContactInfo**
12+
> AbuseResponse getAbuseContactInfo().ip(ip).excludes(excludes).fields(fields).execute();
13+
14+
15+
16+
The Abuse Contact API provides essential contact information to report abusive activity associated with IP addresses. By querying an IP address (IPv4 or IPv6), users receive detailed abuse contact data, including the responsible organization, abuse handling role, contact emails, phone numbers, and registered address. This enables users to swiftly take action to report and mitigate threats such as spam, DDoS attacks, and phishing. In addition to abuse-specific contacts, the API also includes registration metadata like the registered country and abuse handle. This empowers cybersecurity teams, hosting providers, and compliance entities to take appropriate legal or administrative action.
17+
18+
### Parameters
19+
20+
| Name | Type | Description | Notes |
21+
|------------- | ------------- | ------------- | -------------|
22+
| **ip** | **String**| query parameter &#39;ip&#39;. | [optional] |
23+
| **excludes** | **String**| You can exclude specific fields from the API response (except the ip field) by listing them in the excludes parameter as a comma-separated list. For example, you want to remove emails and handle from api response, you can put the keys in excludes parameter like this. | [optional] |
24+
| **fields** | **String**| You can customize the API response by using the fields parameter to include only the specific data you need. For example, to retrieve only the role and emails, specify these keys in the fields parameter as shown below. | [optional] |
25+
26+
### Return type
27+
28+
[**AbuseResponse**](AbuseResponse.md)
29+
30+
### Authorization
31+
32+
[ApiKeyAuth](../README.md#authentication-setup)
33+
34+
### HTTP request headers
35+
36+
- **Content-Type**: Not defined
37+
- **Accept**: application/json, application/xml
38+
39+
### HTTP response details
40+
| Status code | Description | Response headers |
41+
|-------------|-------------|------------------|
42+
| **200** | Successful response | - |
43+
| **400** | Bad Request – Possible reasons include: - If the provided IPv4, IPv6 address, or ASN is invalid. - If special character(s) ( ) [ ] { } | ^ &#x60; is passed in the API URL either as paramter or its value. Specially in case of API key. | - |
44+
| **401** | Unauthorized – Possible reasons include: - Missing or invalid API key - Account unverified, locked, or disabled - Accessing API with an unauthorized key - Subscription expired or downgraded - If your account has been disabled or locked to use by the admin due to abuse or illegal activity. - When the request to IP Abuse Contact API is made using API key for a database subscription - When the request to IP Abuse Contact API is made on the &#39;paused&#39; subscription. - If you’re making API requests after your subscription trial has been expired. - If your active until date has passed and you need to upgrade your account. | - |
45+
| **404** | Not Found – Possible reasons include: - If the IPv4, IPv6, or ASN name does not exist in our database. - If the IPv4, IPv6, or ASN is passed as a path variable, instead of url parameter as ip&#x3D;. - If the wrong endpoint is called, that does not exist in our API. | - |
46+
| **405** | Method Not Allowed – Only GET is allowed for &#x60;/abuse&#x60; endpoint | - |
47+
| **429** | Too Many Requests – Possible reasons include: - If the API usage limit has reached for the free subscriptions, or paid subscriptions with the status &#39;past due&#39;, &#39;deleted&#39; or &#39;trial expired&#39;. - If the surcharge API usage limit has reached against the subscribed plan. | - |
48+
| **499** | Client Closed Request – Client terminated connection before completion | - |
49+
| **500** | Internal Server Error – Something went wrong on our end | - |
50+

0 commit comments

Comments
 (0)