* βeta

World Countries API

 

World Countries Information and ip geocoding  RESTful Web services API


 

World Countries Information and ip geocoding  RESTful Web services API

Response fields:

Examples:

Terms Of Service (TOS):

Geo-location:

Usage Limits and Quotas:

Best Practices while using “World Countries” information and geolocation API service:

Realease Notes:

FAQ:

Registration form:

 


Service Description:

Geognos  provides this web service as an interface for requesting  geocoding and country information from our services for use within your applications.  

This web services responds to HTTP Get requests to specific URLs (end points) by returning data as either json, jsonp, XML or HTML for parsing and/or processing by your application.

A typical Web Service request is of the following form:

http://www.geognos.com/api/en/countries/service_name/counry_code_or_ip.ouput_format  

where:

  1. service_name indicates the particular service requested as follows:
  1. “info”:outputs generic information about the country specified.
  2. “flag”:outputs the flag of the country  specified.
  3. counry_code_or_ip which  can be:
  1. counry_code_or_ip can indicate:
  1. a capitalized ISO 3166-1-alpha-2  country code i.e. "US"  for receiving general information about the particular country. For a list of all World Countries codes you can look here: World Country codes.
  2. or the word “all” for receiving results for all world countries.
  3. or an ip address i.e.  204.193.118.11 for receiving the the ISO country code of the country that this ip belongs  (* see  geo-coding) when service_name="cc" or the information for that particular country when service_name="info".
  4. or  “_” (single underscore character) a special case of the above in which the ip is not defined in the request but instead it is derived from request header.  
  1. output_format indicates the response format and can be one of the following:
  1. “json”
  2. “jsonp” the same as above enclosed in “callback (json)” for use by java script applications.
  3. “xml” (not implemented yet)
  4. “html” it is only available with "info" service and outputs a well formatted html table ready  to be included in your application. You can use the class names included  in the html tags to format the output with css.
  5. “png” is only available with the “flag” service and outputs a png image.

Response fields:

  1. “StatusCode”: An HTTP response code (i.e. 200 for a successful request) - Applications should check this code before proceeding with processing the response.
  2. “StatusMsg”:  A message associated with the response (i.e. “OK”,for successful request)
  3. “Results”: Actual results (depending on the service some result fields can be missing or null):
  1. "Name" is the Name of the country
  2. “SeqID” a sequence Id for this country - can be useful in creating sprite images of flags.
  3. "TelPref" is the international telephone code prefix for that country.
  4. “CountryCodes” a list of country specific codes:
  1. “iso2” the ISO 3166-1-alpha-2 character code
  2. “iso3” the ISO 3 character code
  3. “isoN” the ISO Numeric code
  4. “FIPS” the FIPS code
  5. “tld” the Inernet Top Level Domain code
  6. “GeoPt” Center of Country [latitude, longitude]
  1. “Capital” a list with info about country’s capital:
  1. “Name” Name of the Capital
  2. “TD”         Time Difference from GMT (hours)
  3. “DLST” Day Light saving Time (hours)
  4. “GeoPt” Geographical Coordinates [latitude, longitude]
  1. “GeoRectangle” a list of the Geographical Coordinates of country’s bounding rectangle:
  1. “West”
  2. “North”
  3. “South”
  4. “East”
  1. “CountryInfo” a URL in geognos domain where farther information about this country is provided.

Examples:

  1. http://www.geognos.com/api/en/countries/info/FR.json
  2. http://www.geognos.com/api/en/countries/info/FR.jsonp
  3. http://www.geognos.com/api/en/countries/info/GR.html
  4. http://www.geognos.com/api/en/countries/flag/GR.png
  5. http://www.geognos.com/api/en/countries/info/204.193.118.11.json
  6. http://www.geognos.com/api/en/countries/info/_.json
  7. http://www.geognos.com/api/en/countries/info/all.json
  8. http://www.geognos.com/api/en/countries/cc/_.json
  9. http://www.geognos.com/api/en/countries/info/all.html

Terms Of Service (TOS):

  1. geognos.com general Terms Of Service and privacy policy  are applicable to users of this API service.
  2. This service is free for use strictly on public-facing, non-password protected Web sites / applications.
  3. This Service can be only  used in production from registered applications and after a confirmation email (OK) is sent  back to you in reply to your submission of the Registration form. No API/developer key is required.
  4. Access is granted on a “first come first served” basis except that registration requests for applications running on Google’s App Engine© receive a priority when we process registration requests.
  5. An attribution link to: http://www.geognos.com/ must be provided on any site / application using this service.

Geo-location:

Geo-location is not an exact science so the accuracy of the results can not be guaranteed.  

Our service provides country level results only.

This service works by comparing an ip to an app Engine hosted database of ip blocks and routing tables which is updated daily  from data files provided by RIRS around the world. Some adjustments to compensate for various factors can be applied to those rough data. The service in no way depends on or uses any other third party service, API, or database.

For the time been it only handles ipv4 addresses but we do plan to extend it for handling ipv6.

Usage Limits and Quotas:

  1. Client originated requests from user pages : 1000 Maximum number of requests per day per ip.
  2. Server originated requests: Maximum 12000 requests per day per server domain or app id for (Google Application Engine© based requests).
  3. Requests Rate limit: Maximum 5 requests per ip per second.
  4. Client originated  (i.e. requests from JS running in a browser)  that require a geo-coding operation as described in § 2.c, 2.d above will not be granted. For this kind of service you can look at alternative APIs as Googles js geocoding API.
  5. A limited number of API requests (300 per day) is available to any application - client for testing purposes, no registration is needed for testing.
  6. Application quotas are reset at midnight, Pacific Time.

These limits are enforced to prevent abuse of the service, and may be changed in the future without notice. If you exceed these limits or otherwise abuse the service, this API may stop working for you.
You can request an increase on a particular limit by contacting us, but we can’t guarantee that the increase will be granted
.

Best Practices while using “World Countries” information and geolocation API service:

  1. Use cookies and/or session variables to store results of the service when possible so you can avoid a duplicated request on behalf of same client later.
  2. For the Country information service you can avoid repeated requests for individual countries if you get the information for all countries using “all” as described in  § 2.b, save a copy of the results on your server and use this copy to provide information for a particular country (example #8).
  3. For content heavy requests custom clients can force content to be compressed by specifying both Accept-Encoding and User-Agent headers with a value of   "gzip".
  4. A png image of all flags arranged vertically is provided in:http://www.geognos.com/media/flags/world-countries-flags-80X40.png and http://www.geognos.com/media/flags/world-countries-flags-32X16.pngThese images can be used for serving individual flags as image sprites by offsetting vertical position using css sprites techniques. Offset values can be calculated by using the “IdSeq” field of the “info” request and image dimensions. This is the most efficient way for displaying lots of flags. For an example of using sprites you can look at the source code of the following page:  http://www.geognos.com/api/en/countries/info/IT.html

Realease Notes:

  1. Version 1.0.1 - Date:Dec 22 24:00 GMT

“GeoLat” Center of Country Coordinates Latitude and “GeoLon” Center of Country Coordinates Longitude,  have been replaced by “GeoPt” Center of Country [latitude, longitude]. We have changed this in order for Json output to be more readable and avoid ambiguities.  

FAQ:

  1. Why you provide this service?
  1. Short answer is: there is no specific reason. We just developed the service for use in our own application and thought it is good idea to share it with the community of App Engine developers since the problem of providing geocoding and country information are common in many applications.  We are also ready to open source the code provided we find some more volunteers ready to help with this task.
  1. Why applications running on Google’s App Engine receive a preferable treatment?
  1. Because we can process efficiently only a limited number of requests.
    Applications based on App Engine have an inherent problem of using similar third party API’s  with quota limits based on ip addresses since all of those are served from the same block of ips allocated by Google© and therefore have to share those quotas with other applications hosted on App Engine and using the same service (
    read here and here ), so our priority is to help solving this problem.
  2. Since this service also runs on App Engine,  it minimizes by quite a margin the probability of  having one more “possible point of failure” for applications using it, as any App Engine major disruption will probably affect both this service and any application using it at that time.  
  3. For the same reason we expect reduced latency times when this service is called from applications within Google’s© infrastructure.
  1. Why I must register my application?
  1. Registering helps us with capacity planing, also we need an email address just in case we need to communicate with service users.
  1. What you mean by attribution link?
  1. Any link from the site using the API   to  www.geognos.com  i.e.:

<a href="http://www.geognos.com/geo/en/cc/ad.html" title="World Countries : Andorra" target="_blank">World Countries : Andorra  </a>

  1. Can I simply hotlink to a flag image?

(i.e : <img src="http://www.geognos.com/api/en/countries/flag/AD.png">)

  1. Yes you can provided you include an attribution link in your site as described in TOS.

Registration form:


♦ geognos.com ©®™2010 ♦ Visualizations by Google Visualization API  | Dynamic maps by Google Maps API v3  | Dynamic translations by Google AJAX Language API