Introduction

As web developers, we have to work harder than mobile app developers to gather information about our site visitors. Today, I’ll introduce you to the ipstack API, a service that provides our users’ , lookup, , and organizational identity with a simple low latency query.

can also provide background security data on your visits helping you identify bots, crawlers, anonymous users and bad actors.

The home page for the ipstack.com website and its ip2location time zone lookup an, language and currency services.

The home page for the ipstack.com website and its ip2location time zone lookup an, language and currency services.

The power of having one low latency query to provide this information is potent for any web developer who wishes to provide dynamic experiences for users. ipstack’s average response time is typically 20-50ms.

Here’s an example of a subset of an ipstack response. I had to reduce and adjust it slightly to fit all of the results in a single image. This response is in JSON but XML is also available.

Example of JSON response of an ipstack query for free geolocation, IP to language, timezone lookup, currency, et al.

Example of JSON response of an ipstack query for geolocation, IP to language, timezone lookup, currency, et al.

Essentially, they offer free IP to location or geolocation, IP to language, IP to timezone aka timezone lookup as well as additional hostname and ASN lookups and security details.

ipstack is the result of its merger with FreeGeoIp, which you have likely heard of. The latter service handled more than 2 billion requests worldwide per day. ipstack is providing a faster, more advanced and more scalable API service. And, they already have over 100,000 customers.

ipstack’s geolocation service remains completely free for up to 10,000 requests, which is excellent for startups and entrepreneurs. The majority of the remaining services are available for $9.99 month with a 20% annual discount available.

ipstack response data is also available in eight languages English/US, German, Spanish, French, Japanese, Portuguese (Brazil), Russian, and Chinese.

At last, there’s an affordable, easy to work with alternative to larger corporate geolocation entities and it’s ipstack.

The provider behind ipstack is apilayer. I’ve written about this intriguing company here before. One of my favorite aspects of their sites are how universally simple and easy to access their services are.

apilayer does a great job providing well-designed, easy to integrate, fast, scalable and affordable web services for a variety of customers.

You can read some of earlier tutorials about them below:

Let’s dive into exploring the ipstack API.

Getting Started with ipstack’s Free Geolocation API

Get Your Free API Key

To get started with ipstack, click the orange GET FREE API KEY button in the navigation bar. You can start with the free plan or choose a higher capacity plan. At this time, you can also select monthly or annual billing for a 20% discount.

ipstack Pricing

For individuals just starting out with the API, there is a free account that allows 10,000 requests per month. They always allow you to exceed your account level volume limit by 20% before restricting queries.

ipstack's pricing page showing Free, Basic $9.99, Professional $49.99, Professional Plus $99.99 and custom volume plans.

ipstack’s pricing page showing Free, Basic $9.99, Professional $49.99, Professional Plus $99.99 and custom volume plans.

For $9.99 per month, you get 50,000 requests per month, ip2location, currency information, timezone lookup and hostname and ASN organizational details. The ASN is a code associated with the organization that manages a range of IP addresses.

Higher level plans provide bulk processing, which allows you to gather data about large numbers of ip addresses you already have, often from your existing customer base. With the Professional Plus plan at $99.99 per month, you gain access to security details. Again, 20% discounts are available for annual accounts.

All paid plans gain SSL access via HTTPS.

The Sign Up Form

Once you’ve chosen a plan you’ll be asked to complete a sign up form. It’s very straightforward:

Blank sign up form at ipstack's website ipstack.com.

Blank sign up form at ipstack’s website ipstack.com.

Once completed, you’ll land in the dashboard and receive a friendly email with links to documentation and support.

Welcome email received after signing up at ipstack.com.

Welcome email received after signing up at ipstack.com.

The ipstack API Dashboard

The Quickstart Guide

ipstack’s API dashboard provides your API key and a simple 3 step quickstart guide:

 3-step quickstart guide at ipstack after sign up.

3-step quickstart guide at ipstack after sign up.

Step 1 – Your API Access Key
Your API access key provides access to the ipstack API. It’s required to be included as a parameter in every call. You can also reset the key to secure a new one whenever you wish.

Step 2 – Reviewing the Six API Endpoints
Overall, there are three primary methods for making use of ipstack API services:

  • Standard Lookup: Looks up the data behind a specific IP address you provide in the request.
  • Bulk Lookup: Look up the data for multiple IP addresses at once, which you provide in the request.
  • Requester Lookup: Look up the data behind the IP address the current API request is coming from i.e. the requesting API is the specified IP address.

Base URL: Whichever API method you choose to use, all API requests to the ipstack API start out with the following base URL: https://api.ipstack.com/

// Standard IP Lookup - look up the data behind an IP address
https://api.ipstack.com/134.201.250.155
    ? access_key = YOUR_ACCESS_KEY
    
// optional parameters: 
    & fields = ip,location,security
    & hostname = 1
    & security = 1
    & language = en // ip to language
    & callback = MY_CALLBACK
    & output = json

Here’s an example response in JSON:

{
  "ip":"104.128.136.44",
  "type":"ipv4",
  "continent_code":"NA",
  "continent_name":"North America",
  "country_code":"US",
  "country_name":"United States",
  "region_code":"WA",
  "region_name":"Washington",
  "city":"Seattle",
  "zip":"98168",
  "latitude":47.4891,
  "longitude":-122.2908,
  "location":{
    "geoname_id":5809844,
    "capital":"Washington D.C.",
    "languages":[
      {
        "code":"en",
        "name":"English",
        "native":"English"
      }
    ],
    "country_flag":"http://assets.ipstack.com/flags/us.svg",
    "country_flag_emoji":"ud83cuddfaud83cuddf8",
    "country_flag_emoji_unicode":"U+1F1FA U+1F1F8",
    "calling_code":"1",
    "is_eu":false
  },
  "Time_zone":{ 
    "id":"America/Los_Angeles",
    "current_time":"2018-07-25T17:26:46-07:00",
    "gmt_offset":-25200,
    "code":"PDT",
    "is_daylight_saving":true
  },
  "currency":{
    "code":"USD",
    "name":"US Dollar",
    "plural":"US dollars",
    "symbol":"$",
    "symbol_native":"$"
  },
  "connection":{
    "asn":63008,
    "isp":"Contina"
  }
}

Note that ipstack allows you to customize and minimize the response set of the data request to improve response times and minimize bandwidth.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here