Validate and Geolocate an IP Address in Java

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.54</version>
</dependency>
</dependencies>
// 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;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
IpAddressApi apiInstance = new IpAddressApi();
String value = "value_example"; // String | IP address to process, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
try {
IPIntelligenceResponse result = apiInstance.iPAddressIpIntelligence(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IpAddressApi#iPAddressIpIntelligence");
e.printStackTrace();
}

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Blog Entry #8

NoodlesOodles (sidenote: .gitignore)

Create a VPC And Deploy Public WordPress Site With Private MYSQL Database Using Terraform

How to transfer your Realtime Database to CMS in minutes

Find Out Why Python Is the Right Choice for a Job in the Tech Industry

Python day-to-day growth in 2021.

PYTHON 2021

Different Ways To Filter Pandas DataFrame

4 Best Engineering Agencies to Develop a Partnership

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
Cloudmersive

Cloudmersive

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

More from Medium

Video Processing API: Resize a Video (Preserving Original Aspect Ratio) with Java

Elasticsearch how to build search system

LogMasker — OpenSource masking library for Java

Orchestrating multiple dockers with Swarm