Project closed
Article

API: data in JSON- and JSONP format

There was the possibility to insert JavaScript (which contained an object with different parameters based on user's IP address) into projects. Now you can get these data in JSON- and JSONP format.

Data returned from API, based on the client's IP address:

  • latitude - the latitude of the country
  • longitude - the length of the country
  • zoom — the degree of approximation for maps based on Google Maps
  • address.city — the city (not available now)
  • address.country — the country
  • address.country_code — the country code according to ISO 3166-1
  • address.region — the region (not available now)

JSON

The query format:
http://api.wipmania.com/json
The answer looks like:
{"latitude":"51.0993","longitude":"10.4537","zoom":5,"address":{"city":"-","country":"Germany","country_code":"DE","region":"-"}}

JSONP

The query format:
http://api.wipmania.com/jsonp?callback=YourFunctionHere

YourFunctionHere - your name for the function

The answer looks like:

YourFunctionHere({"latitude":"51.0993","longitude":"10.4537","zoom":5,"address":{"city":"-","country":"Germany","country_code":"DE","region":"-"}})
Example of use with JQuery:
$.getJSON("http://api.wipmania.com/jsonp?callback=?",
 function(data) {
   alert(data.address.country);
});
As for the JavaScript version, there are no restrictions on the number of queries.