fbpx

How to Use Address Geolocation API

A split-screen image showing a text editor with a JSON-formatted API response for an Address Geolocation query on the left, and an iPhone app displaying a mapped location of a person with associated local information like date, time, zip code, region, and currency on the right.

The ability to obtain accurate address information is fundamental for a multitude of applications and businesses. Whether it’s for delivery services, location-based marketing, or even real estate analysis, EasyAPI’s Address Endpoint has you covered. This endpoint can provide an extensive range of information like date/time details, formatted address, geographical coordinates, and much more.

Pre-Requisites

To start using this endpoint, you’ll need an API key from EasyAPI. If you haven’t obtained this yet, you can refer to our Getting Started Guide.

Step 1: Make an API Request

In Browser

Simply paste the following URL into your browser, replacing YOUR_API_KEY  with your actual API key:

				
					https://api.easyapi.io/v1.0/address?address=mayflower%20street,%20london&api_key=YOUR_API_KEY
				
			

In Python

Using Python’s requests library, the API call can be made as follows:

				
					import requests
import json

response = requests.get("https://api.easyapi.io/v1.0/address?address=mayflower%20street,%20london&api_key=YOUR_API_KEY")
data = json.loads(response.text)

				
			

To run this code, install the requests library if you haven’t yet:

				
					pip install requests

				
			

In PHP

In PHP, use curl to make the API request:

				
					<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.easyapi.io/v1.0/address?address=mayflower%20street,%20london&api_key=YOUR_API_KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
?>

				
			

Step 2: Analyze the Response

The API will return a JSON response, similar to the one below:

				
					{
   "class":"address_info",
   "properties":[
        {
          "datetime":{
             "date":"08/23/2023",
             "date_time":"08/23/2023 20:39:30",
             "date_time_txt":"Wednesday, August 23, 2023 20:39:30",
             "date_time_wti":"Wed, 23 Aug 2023 20:39:30 +0100",
             "date_time_ymd":"2023-08-23T20:39:30+0100",
             "day":"23",
             "day_abbr":"Wed",
             "day_full":"Wednesday",
             "day_wilz":"23",
             "hour_12_wilz":"08",
             "hour_12_wolz":"8",
             "hour_24_wilz":"20",
             "hour_24_wolz":"20",
             "hour_am_pm":"pm",
             "minutes":"39",
             "month":"08",
             "month_abbr":"Aug",
             "month_days":"23",
             "month_full":"August",
             "month_wilz":"08",
             "seconds":"30",
             "time":"20:39:30",
             "week":"34",
             "year":"2023",
             "year_abbr":"23"
          },
          "formatted_address":"Mayflower St, London SE16, UK",
          "location":"51.5000232,-0.0551781",
          "timezone":{
             "capital":"London",
             "continent":"EU",
             "country":"Britain (UK)",
             "country_code":"GB",
             "currency_alpha_code":"GBP",
             "currency_code":"826",
             "currency_country_minor_unit":"2",
             "currency_country_name":"UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND",
             "currency_name":"Pound Sterling",
             "ds":"GB",
             "edgar":null,
             "fifa":"ENG,NIR,SCO,WAL",
             "fips":"UK",
             "gaul":"256",
             "geoname_id":"2635167",
             "id":"Europe/London",
             "independent":true,
             "ioc":"GBR",
             "iso3166_1_alpha_2":"GB",
             "iso3166_1_alpha_3":"GBR",
             "itu":"G",
             "languages":"en-GB,cy-GB,gd",
             "location":"51.50833333333333, -0.12527777777777777",
             "marc":"xxk",
             "phone_prefix":"44",
             "tld":".uk",
             "un_m49_code":"826",
             "wmo":"UK"
          }
        }
   ]
}
				
			

Understanding the JSON Fields

Field NameDescriptionExample Values
classRepresents the type of data“address_info”
properties[*].datetime.dateThe date“08/23/2023”
properties[*].datetime.date_timeComplete date and time“08/23/2023 20:39:30”
properties[*].datetime.date_time_txtDate and time in text format“Wednesday, August 23, 2023 20:39:30”
properties[*].datetime.date_time_wtiDate and time with timezone information“Wed, 23 Aug 2023 20:39:30 +0100”
properties[*].datetime.date_time_ymdDate and time in year-month-day format“2023-08-23T20:39:30+0100”
properties[*].datetime.dayDay of the month“23”
properties[*].datetime.day_abbrAbbreviated day name“Wed”
properties[*].datetime.day_fullFull day name“Wednesday”
properties[*].datetime.day_wilzDay of the month (same as day)“23”
properties[*].datetime.hour_12_wilzHour in 12-hour format (zero-padded)“08”
properties[*].datetime.hour_12_wolzHour in 12-hour format“8”
properties[*].datetime.hour_24_wilzHour in 24-hour format (zero-padded)“20”
properties[*].datetime.hour_24_wolzHour in 24-hour format“20”
properties[*].datetime.hour_am_pmAM/PM designation“pm”
properties[*].datetime.minutesMinutes“39”
properties[*].datetime.monthMonth in numeric format“08”
properties[*].datetime.month_abbrAbbreviated month name“Aug”
properties[*].datetime.month_daysDay of the month (same as day)“23”
properties[*].datetime.month_fullFull month name“August”
properties[*].datetime.month_wilzMonth in numeric format (same as month)“08”
properties[*].datetime.secondsSeconds“30”
properties[*].datetime.timeTime in hh:mm:ss format“20:39:30”
properties[*].datetime.weekWeek number“34”
properties[*].datetime.yearYear in full“2023”
properties[*].datetime.year_abbrYear abbreviated“23”
properties[*].formatted_addressThe full formatted address“Mayflower St, London SE16, UK”
properties[*].locationGeographical coordinates“51.5000232,-0.0551781”
properties[*].timezone.capitalCapital city“London”
properties[*].timezone.continentContinent“EU”
properties[*].timezone.countryCountry name“Britain (UK)”
properties[*].timezone.country_codeCountry code“GB”
properties[*].timezone.currency_alpha_codeCurrency code in alphabetic format“GBP”
properties[*].timezone.currency_codeNumeric currency code“826”
properties[*].timezone.currency_country_minor_unitNumber of decimals in currency“2”
properties[*].timezone.currency_country_nameFull name of the country for the currency“UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND”
properties[*].timezone.currency_nameCurrency name“Pound Sterling”
properties[*].timezone.dsDS code“GB”
properties[*].timezone.edgarEDGAR code (if available)null
properties[*].timezone.fifaFIFA code“ENG,NIR,SCO,WAL”
properties[*].timezone.fipsFIPS code“UK”
properties[*].timezone.gaulGAUL code“256”
properties[*].timezone.geoname_idGeoname ID“2635167”
properties[*].timezone.idTimezone ID“Europe/London”
properties[*].timezone.independentCountry independence statustrue
properties[*].timezone.iocIOC code“GBR”
properties[*].timezone.iso3166_1_alpha_2ISO 3166-1 alpha-2 country code“GB”
properties[*].timezone.iso3166_1_alpha_3ISO 3166-1 alpha-3 country code“GBR”
properties[*].timezone.ituITU code“G”
properties[*].timezone.languagesLanguages spoken“en-GB,cy-GB,gd”
properties[*].timezone.locationTimezone coordinates“51.50833333333333, -0.12527777777777777”
properties[*].timezone.marcMARC code“xxk”
properties[*].timezone.phone_prefixCountry phone prefix“44”
properties[*].timezone.tldTop-level domain“.uk”
properties[*].timezone.un_m49_codeUnited Nations M49 code“826”
properties[*].timezone.wmoWorld Meteorological Organization (WMO) country code“UK”

Note: The asterisk (*) in properties[*] indicates that these fields can exist in multiple objects within the properties array.

Feel free to consult this table for understanding each field that the API response may contain.

Step 3: Implement in Your Application

With the data parsed, it can now be utilized in a variety of applications:

  • Delivery Services: Precisely target the delivery areas.
  • Marketing: Conduct location-based marketing strategies.
  • Analytics: Analyze the geographic distribution of your users.

Your application’s capabilities have just been greatly enhanced. Well done!

Conclusion

The EasyAPI Address Endpoint provides a robust solution for obtaining crucial address information. Equipped with this, you can more effectively tune your services, enhance user experience, and make data-driven decisions.

What's Next?

  • Getting Started Guide: If you are new or need a refresher.
  • IP Address Lookup Guide: Learn how to fetch additional information based on IP addresses.
  • Timezone API Guide: Understand time zones for even more comprehensive data.
  • API Docs: For an in-depth look at all functionalities, our API documentation is available.

Choose the Plan That Fits Your Need

Easy, transparent, and budget-friendly!

Starter

$3/month

Commercial

$37/month

Premium

$59/month

Business

$139/month