📜 ⬆️ ⬇️

Sypex Geo 2.2 - now with GeoNames and OKATO

A new version of Sypex Geo 2.2 has been released - a very fast algorithm for determining a city by IP. Now the databases have become bilingual (Russian and English), regions and cities are now tied to the GeoNames database, and have permanent IDs.

OKATO codes for cities and regions of Russia, KOATUU for Ukraine and SOATO for Belarus were added.

Technical details


The algorithm of Sypex Geo has not changed significantly, small errors have been corrected, which occurred with a strong uneven distribution of IP ranges.

Major changes were made to directories.

More information about the data format can be found in the specification format SxGeo 2.2 .
')

REST API


Together with the new version of Sypex Geo, the REST API service was launched. Where using a simple HTTP or HTTPS request, you can get the most up-to-date and extensive IP information using the latest Sypex Geo Max database.

Results can be issued in 3 formats: JSON, JSONP and XML. Batch processing is supported, up to 100 IP per request.

The simplest API request is:
api.sypexgeo.net
As a result, you will receive information about your IP in JSON format.
{ "ip":"123.45.67.89", //  IP "city":{ //    "id":1835848, // ID   GeoNames "lat":37.566, //   "lon":126.9784, //   "name_ru":"", //    "name_en":"Seoul", //    "okato":"" //     ,        }, "region":{ //    "id":1835847, // ID   GeoNames "lat":37.58, //   "lon":127, //   "name_ru":"", //    "name_en":"Seoul", //    "iso":"KR-11", // ISO3166-2   "timezone":"Asia/Seoul", //    "okato":"" //     ,        }, "country":{ //    "id":119, // ID  "iso":"KR", // ISO3166-1   "continent":"AS", //   "lat":36.5, //    "lon":127.75, //    "name_ru":" ", //    "name_en":"South Korea", //    "timezone":"Asia/Seoul" //    }} 


The same data in xml can be obtained by running
api.sypexgeo.net/xml

To get information about an arbitrary IP, you need to run the query:
api.sypexgeo.net/json/123.45.67.89

If you need to check several IP at once, you just need to list them separated by a comma or a semicolon
api.sypexgeo.net/json/123.45.67.89;222.22.22.22

To get data in JSONP format, you need to run the query:
api.sypexgeo.net/jsonp/123.45.67.89&callback=alert

POST requests are also allowed, in which case IPs are specified in the ip parameter.

Related Links

Source: https://habr.com/ru/post/221893/


All Articles