Validate and Geolocate an IP Address in Java

Did you know that just by looking at information provided by a client’s IP address, you can gain greater insight into their needs? Utilizing the following API can provide you with key intelligence about an IP address, including its location, and whether it’s a bot, botnet, or other form of malware. The location information can be leveraged to better target your users/clients, and the threat identification can guard your business and clients from cyberattacks.

Image for post
Image for post

To use this Cloudmersive API, you can install the following SDK with Maven by adding a reference to the repository in pom.xml:

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

Next, add a reference to the dependency:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.54</version>
</dependency>
</dependencies>

Then, you can call the function by using the following code:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.IpAddressApi;

Your results will be returned in no time at all, and this process can be repeated for any IP address you plug into the code. To retrieve your free API key, navigate over to the Cloudmersive website; this will also give you access to 800 monthly API calls.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store