Subscribe to a Premium Development Newsletter by TheDevCouple! What is TheDevTakeaway?

Almost all of usย have come across the termย IP Address while using the internet. An IP address is a numerical label used to identify the presence of a digital device on the Internet. In other words, it is the physical address of a device in the online world.

Whenever a device communicates with other devices over the Internet, they use IP addresses to keep track of each other. So, for example, if you want to load a website on your device, a request will be sent with your IP address to the site’s server.

Any information regarding the geolocation of an IP address of your site’s visitor can tell you from which part of the world he visited your website. This type of information can be handy to any person who wants to know more about their visitors.

There are many tools available on the Internet which can tell the geolocation of the IP addresses and we have reviewed a couple of them at WPCouple. Recently, while finding such a tool for one of my client projects, I came across this incredible API known asย IP Geolocation API by Whois API Inc.

I jumped on the opportunity to try out this API, and it proved that it was worth every second of my time. This incredible API help you instantly find the physical location of an IP address along with other related parameters โ€” more on this later.

After integrating this API with my client’s project, and seeing this API in action, I am super excited to share it with you. So let’s get started, shall we?

๐Ÿ“Œ IP Geolocation API by WhoisXMLAPI

Ip Geolocation Api Review Header Image

IP Geolocation API is a product of Whois API Inc. โ€” one of the leading Whois API Webservices and data providers.ย The incredibleย Jonathan Zhang, the CEO of Whois API LLC, leads this company. It was launched eight years ago in 2010. Their headquarters is inย Walnut, California.

Besides IP Geolocation API, they also have a great range of other web products. A few of them are:

  • ๐Ÿ“ฎย Email Verification API โ€” An API to verify email address individually or in bulk. We recently reviewed this API at WPCouple.
  • ๐Ÿ”ย Reverse IP APIย โ€” An interesting API for discovering connected domains hosted on the same IP address.
  • ๐Ÿšจย Threat Intelligence APIย โ€” This one lets you analyze host for any suspicious activity and we plan to review it soon. So, stay updated!
  • โœ…ย Domain Availability APIย โ€” It enables you to check the availability of domain names in almost every TLDs.

๐Ÿ†

During this period of less than a decade, Whois API Inc managed to serve the fortune 500 companies. They have an impressive list of clients including big names like Apple, Cisco, AT&T, eBay, Amazon, IBM, and Symantec. They manage an extensive database of 5 billion+ historic WHOIS records, 1.2 billion+ domains and subdomains, 2,864+ TLDs & ccTLDs, 8.7 million+ IP netblocks, and 99.5% IP addresses in use.

Getting back to IP Geolocation API, it currently has ~1100 satisfied customers with 15M+ IP blocks and locations. You can inquire about any email address using an HTTP request. The API can respond in one of these two formats โ€” JSON or XML.

๐ŸŽฉ Features of the IP Geolocation API

IP Geolocation API allows you to query the geo information related to an IP address. Let’s quickly take a look at the information returned by this API.

  • ๐ŸŒ† City
  • โฐ Timezone
  • ๐Ÿ“ซ Postal Code
  • ๐Ÿ“ Latitude/Longitude
  • ๐Ÿ—บ Region/State/Province
  • ๐Ÿ‡บ๐Ÿ‡ธ Country โ€” Name of the country in which the IP address is located.

Ip Geolocation Api Results

๐Ÿš€ Performance

Performance of an API is one of the most important metrics that anyone can use to judge its ability. If an API is not able to deliver results promptly, then it might just not work at all. Because in a real-time system, waiting time should be next to zero.

Since this API has over 15 million IP blocks and locations, I decided to the conduct a little performance testing of my own on this API. The results were nothing better than hitting a home run. ๐Ÿ”ฅ

I used the desktop App of Postman to perform a bunch of queries for the same IP address, and the following are the shining details of my little experiment.

  • โฑ Response time for my first request was around ~1 โ€“ 2 seconds.
  • โšก๏ธ Average response time for my request, when I made the same request again & again, was reduced to ~400 โ€“ 600 milliseconds.

Ip Geolocation Api Performance Results

๐Ÿ‘‰ You can see from the results that the response time decreased by more than 50% which indicates that this API is using caching to reduce their response time.

๐Ÿค˜ Benefits of Using IP Geolocation API

There are a lot of benefits of using IP Geolocation API that any online business owner can take advantage of. Let’s briefly take a look at some of these advantages.

๐Ÿ–ผ Content Personalization

You can build custom experiences for visitors from different countries. It isย a great feature for an e-commerce website. Using the geolocation data, a store owner can show the products related to a specific region of the world.

E-commerce websites can also use the IP Geolocation API to detect the country of their visitors and then use this information to switch the currency to the currency of the visitor’s country or offer different percentages of discount to your products.

๐Ÿ”‘ Location Based Access Control

You can control the access to your website using this API. Since the API provides the geolocation of an incoming visitor, you can check whether they are allowed to view your website or not and control their view accordingly.

You can also use this API to give your users access to your services present within a specific IP geolocation range.

๐Ÿ‘ฎ Security Applications

You can keep a close watch on the IP addresses visiting your website from any part of the world. If any IP address is showing a suspicious behavior or doing something that it is not supposed to do, then you can track down the originating location, and then act on the information accordingly.

Another great benefit of using IP Geolocation API is that you can compare visitor IP addresses on your e-commerce website with some known customer data to detect online fraud and identity theft.

โš™๏ธ Working

As mentioned earlier, this API is pretty straightforward to use. If you want geo-information about an IP address, you need to send an HTTP request to the API along with some parameters. Let’s take a look at how you can perform this query.

Before making a request, you need to sign up for the IP Geolocation API. After signing up, you get a free monthly quota of 1000 queries. If you are performing more than a 1000 requests, you need to buy credits.

โ†’ HTTP Request

There are two parameters required to send an HTTP request to the API.

  1. ๐Ÿ”‘ API Key โ€” You will get yours once you sign up for the API.
  2. ๐Ÿ’ปย IP Address โ€” IP address whose information needs to be queried.
  3. ๐ŸŽจ Output Format (Optional) โ€” Response output format.

You can grab your API key from the dashboard of the API website and make an HTTP request at the following endpoint.

If you go to the website of IP Geolocation API, you will find code samples for all the major programming languages. These languages includeย C#, Java, JavaScript, NodeJS, Perl, PHP, PowerShell, Python, and Ruby. Now, all you need to do is grab the sample code, make the appropriate changes, and your code will be ready to rock and roll. ๐Ÿค˜

IP Geolocation API โ€“ Sample Codes

๐ŸŽฏ Performing a GeoIP Lookup with NodeJS

JavaScript is slowly becoming a new standard language for developing web applications. If you’re one of those guys who uses NodeJS to build their web apps, then you’re in luck! There is an NPM package explicitly written for IP Geolocation API. Follow the quick steps below to get started.

โ†’ Step #1

Get yourself an account on IP Geolocation API’s website. As I mentioned earlier, you get 1000 GeoIP requests free per month. In case, you need more; you can purchase more queriesย from their site.

โ†’ Step #2

The NPM package which I mentioned earlier is calledย simple-geoip. You can install it using NPM inside your application. Follow these steps to whip up a new NodeJS application quickly:

  • โœ… Open your terminal.
  • ๐ŸŽฏ Create a new directory โ€” sample-app โ€” and go inside this directory.
  • ๐Ÿ‘‡ Enter the following command to create a new NodeJS application.
  • ๐Ÿ‘Š Now enter the following command to installย simple-geoip.

โ†’ Step #3

Since you have installed the NPM package successfully inside your application, the next step is considerably simple. Now you need to include the package inside your application file to perform a GeoIP Lookup of an IP address. Below is a heavily commented gist to help you accomplish that.

This is the simplest way of getting theย geo-information of an IP address in your application. You can read the detailed documentation on their website to start customizing your code. A sum of three steps is enough to get your application up and running with IP Geolocation API. Awesome! ๐Ÿ‘Œ

๐Ÿ”ฅ Support & Documentation

A product is only as good as its support and documentation. If the support of a product is not reachable, then you might not wantย to use it in your projects โ€” to be on the safe side.

I found the support of this API to be reachable within a few hours when you first approach them. After that, their response time decreases with every support query which is commendable. Thumbs up for the serviceย ๐Ÿ‘

IP Geolocation API also has a section of API Docsย available for everyone on their website. The documentation covers everything which an individual needs to know before using this API and the expected results after using it.

IP Geolocation API โ€“ Documentation

๐Ÿ’ฐ Pricing

There are three types of payment packages available for the API queries, which are:

  • 1๏ธโƒฃ One-time Purchase
  • 2๏ธโƒฃ Monthly Subscription
  • 3๏ธโƒฃ Yearly Subscription

There is also a custom package available for those who want a different package according to their needs. Contact the company using their contact form to negotiate the custom pricing.

๐ŸŒŸ For those who want to get the hang of the API, there are a 1000 API queries available for free on a monthly basis.

Ip Geolocation Api Pricing

๐Ÿ™Œ Final Thoughts!

IP Geolocation API is an impressive API for getting GeoIP data of an IP address. It is straightforward to implement and can be used to detect fraud, identify suspicious behavior, and access management on your online store.

So, whether you are a business manager or a developer, you should give this API a shot. You can use this API to make your website more secure and reliable. It can also help you build a list of safe and loyal customers.

Are you already using this API in your business? Or are you looking for one right now? Let me know your comments in the section below.

Peace! โœŒ๏ธ

๐Ÿ™Œ

SUBSCRIBE TO DEVELOPERS TAKEAWAY!

A Premium Development Newsletter by TheDevCouple! What is TheDevTakeaway?

There are currently no comments.

๐Ÿ™Œ You must have something to say here...