API

Welcome to the GeoJoe API!

If you didn't know, GeoJoe is an online look-up service for locating IP addresses, servers and domain names. Simply input an IP or server name on the main GeoJoe website and GeoJoe will tell you exactly where in the world it is - often right down to the city, town or village - along with precise geographical co-ordinates and other such useful data.

GeoJoe API for Developers and Webmasters

The GeoJoe API (Application Programming Interface) allows developers and webmasters to retrieve geolocation data for embedding within their own websites and applications . Using simple query syntax, users can pass the API single or multiple IP addresses and get back a variety of results, depending upon their requirements, in various formats.

The GeoJoe API currently contains:

  • Returning of all Geolocation data for a single IP address;
  • Returning an array from a batch of IP addresses;
  • Display a configurable badge for a single IP address;
  • Display a country flag for a single IP address;
  • Display a world map with real-time plotting of visitor origin

Calling the API functions

Single

The single format takes an IP address and returns all geolocation data in key/value pairs.

Method Name: single

URL: http://www.geojoe.co.uk/api/single

Passed Variables: ip or domain name (optional)

Returned Formats: key/value pairs

Returned Variables:

  • ip
  • country_code
  • country_name
  • region
  • city
  • latitude
  • longitude

Example Call

http://www.geojoe.co.uk/api/single/?ip=209.85.171.99

Note: If you omit the ip variable the IP calling the script will be used.

Example Output

ip=209.85.171.99&country_code=US&country_name=United States&region=California&city=Mountain View&latitude=37.4192&longitude=-122.0574

Batch

The batch format takes a CSV of IP address and returns all geolocation data in the chosen format.

Method Name: batch

URL: http://www.geojoe.co.uk/api/batch

Passed Variables: ips - CSV of IP addresses or domain names, format

Returned Formats: key/value pairs (default) or XML

Returned Variables:

  • ip
  • country_code
  • country_name
  • region
  • city
  • latitude
  • longitude

Example Call

http://www.geojoe.co.uk/api/batch/?ips=209.85.171.99,127.0.0.1,127.0.0.1&format=xml

Note: If you omit the format variable, the default key/value pairs will be returned.

Example XML Output

<?xml version="1.0" encoding="iso-8859-1"?>
<results>
<geodata>
<ip>xx.xx.xx.xx</ip>
<country_code>US</country_code>
<country_name>United States</country_name>
<region>California</region>
<city>Mountain View</city>
<latitude>37.4192</latitude>
<longitude>-122.0574</longitude>
</geodata>...
...
<results>

Badge

The badge call takes an IP address and generates a badge based on the visitor's IP address.

Method Name: badge

URL: http://www.geojoe.co.uk/api/badge

Passed Variables: ip or domain name, text, bg, border

Returned Formats:Embedded Image (using GD)

Returned Variables: Not Applicable

Example Call

Simply copy and paste the following code into your page where you want the badge to appear:

<img src="http://www.geojoe.co.uk/api/badge/?ip=209.85.171.99&text=darkgreen&bg=ivory&border=darkgreen" alt="GeoJoe - IP Geolocation Services" title="GeoJoe - IP Geolocation Services" width="200" height="60" />

Note: If you omit the ip variable, the IP calling the script will be used.

Here's how it looks

GeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation Services

GeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation Services

GeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation Services

GeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation Services

GeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation ServicesGeoJoe - IP Geolocation Services

Variables you can change

You can modify the following variables (shown in bold italics above) to change the colours of your badge.

  • ip - IP address or domain name to locate
  • text - the main text
  • bg - the main background colour
  • border - the border, or frame around the badge

Available colours

You can combine any of the following colours:

  • white
  • grey
  • black
  • red
  • lightblue
  • blue
  • lightorange
  • orange
  • green
  • darkgreen
  • pink
  • grey
  • lilac
  • chocolate
  • coffee
  • khaki
  • ivory

Default Badge

If you do not include any variables, you'll see the default colours...

<img src="http://www.geojoe.co.uk/api/badge/" alt="GeoJoe - IP Geolocation Services" title="GeoJoe - IP Geolocation Services" width="200" height="60" />

GeoJoe - IP Geolocation Services

Flag

The badge call takes an IP address and generates a flag based on an IP address.

Method Name: badge

URL: http://www.geojoe.co.uk/api/flag

Passed Variables: ip or domain name (optional)

Returned Formats:Embedded Image (using GD)

Returned Variables: Not Applicable

Example Call

Simply copy and paste the following code into your page where you want the flag to appear:

<img src="http://www.geojoe.co.uk/api/flag/?ip=209.85.171.99" />

Note: If you omit the ip variable, the IP calling the script will be used.

Example Output

GeoJoe - IP Geolocation Services - with IP address

GeoJoe - IP Geolocation Services - fixed ip address (Google)

You could use CSS and place the image between a <span> or <div> to format it further.

More instructions coming soon!