Table of Contents
GeoIP API
The API is *very* much in alpha, so let me know if you have any problems or requests.
JSON
Data will return in JSON by default.
If you pass a “callback” param, the data will be passed to a function using the callback value for the function name.
Using cURL
You can easily use cURL in the command line to test out responses.
Example:
curl http://geoip.prototypeapp.com/api/locate
API Methods
Many of these methods will return a HTTP 204 No Content
on failure.
Locate Method
geoip.prototypeapp.com/api/locate
This method returns JSON (by default) or XML using the format
parameter.
If you don't pass it an IP address, it will try to use the referrer's address.
Parameter | Type |
---|---|
ip | string - an IP address |
format | either 'xml' or 'json' - defaults to 'json' |
The response should look like:
{ "ip":"69.163.181.149", "timestamp":1263028293112, "location": { "coords": { "latitude":"33.9269", "longitude":"-117.861" }, "address": { "city":"Brea", "country":"United States", "country_code":"US" }, "gmtOffset":"-8", "dstOffset":"-7" } }