Page tree
Skip to end of metadata
Go to start of metadata

Overview

The data provided by GeoIP Service is used by the Distributed System for GeoIP-tagging of events. Fresh data is imported weekly from MaxMind's database to the GeoIP Service by a separate component. The importer uses the GeoIP Service through SMB-layer. All the data changes (add/update) are propagated through the Component Administration Service's forceUpdateResources-method calls. The distributed components that listen to these notifications use the Resource Manager component to fetch the fresh data directly from GeoIP Service through the SMB-layer. Neither the data import nor resource fetching currently use the REST-layer. Future plans include moving the importer to use the REST-layer and the resource fetching to WebSocket-layer (it wouldn't be fetching but listening for updates).

Concepts

  • Country contains the following basic data about the countries: country name, country code.
  • Region is a subunit of countries, contains the following data: region name, region code, the country it belongs to and locations covered by this region.
  • Location is a subunit of regions, contains the following data: external ID, city name, postal code, metro code, area code, latitude, longitude, the region and country it belongs to.
  • IP Range is the data structure for specifying IP-address range by start- and end-address. It also contains the following data: latitude, longitude and the location it belongs to.
  • IP Address can be either IPv4 or IPv6 address.

Data Model

Permissions

Managing/changing GeoIP information requires the GEOIP-MANAGER role. There are currently no other roles defined for this service.

API Usage Examples

Only some operations are listed here. Please consult the Swagger API documentation for the complete list of supported operations and the statuses of the endpoints (PUBLIC, INTERNAL, DEV).

Listing countries

Request:

curl -X GET -H "Argus-API-Key: $API_KEY_ENV_VAR" https://api.mnemonic.no/geoip/v1/country?fromID=699

Response:

{
  "responseCode": 200,
  "limit": 25,
  "offset": 0,
  "count": 184,
  "metaData": {},
  "messages": [],
  "data": [
    {
      "id": 699,
      "countryName": "ESTONIA",
      "countryCode": "EE",
      "lastModified": 1384636074867,
      "flags": []
    },
    ...
  ],
  "size": 25
}

Searching for a country

Request:

curl -X POST -H "Argus-API-Key: $API_KEY_ENV_VAR" -H "Content-Type: application/json" https://api.mnemonic.no/geoip/v1/country/search -d '{
  "fromID": 699
}'

The response returns the same format as listing countries.

Fetching a location

Request:

curl -X GET -H "Argus-API-Key: $API_KEY_ENV_VAR" https://api.mnemonic.no/geoip/v1/location/699000000732

Response:

{
  "responseCode": 200,
  "limit": 0,
  "offset": 0,
  "count": 0,
  "metaData": {},
  "messages": [],
  "data": {
    "id": 699000000732,
    "extID": 588409,
    "countryCode": "EE",
    "cityName": "Tallinn",
    "lastModified": 1658923216878,
    "flags": []
  },
  "size": 0
}

Listing locations

Request:

curl -X GET -H "Argus-API-Key: $API_KEY_ENV_VAR" https://api.mnemonic.no/geoip/v1/location?fromID=699000000732

Response:

{
  "responseCode": 200,
  "limit": 25,
  "offset": 0,
  "count": 1123086,
  "metaData": {},
  "messages": [],
  "data": [
    {
      "id": 699000000732,
      "extID": 588409,
      "countryCode": "EE",
      "cityName": "Tallinn",
      "lastModified": 1658923216878,
      "flags": []
    },
    ...
  ],
  "size": 25
}

Searching for a location

Request:

curl -X POST -H "Argus-API-Key: $API_KEY_ENV_VAR" -H "Content-Type: application/json" https://api.mnemonic.no/geoip/v1/location/search -d '{
  "country": [
    "EE"
  ]
}'

The response returns the same format as listing locations.

Searching for an IP range

Request:

curl -X POST -H "Argus-API-Key: $API_KEY_ENV_VAR" -H "Content-Type: application/json" https://api.mnemonic.no/geoip/v1/ranges/search -d '{
  "fromIP": "5.101.176.0",
  "toIP": "5.101.176.255"
}'

Response:

{
  "responseCode": 200,
  "limit": 25,
  "offset": 0,
  "count": 1,
  "metaData": {},
  "messages": [],
  "data": [
    {
      "id": 291076,
      "range": {
        "fromAddress": {
          "host": true,
          "ipv6": false,
          "maskBits": 32,
          "multicast": false,
          "public": true,
          "address": "5.101.176.0"
        },
        "toAddress": {
          "host": true,
          "ipv6": false,
          "maskBits": 32,
          "multicast": false,
          "public": true,
          "address": "5.101.191.255"
        }
      },
      "countryCode": "EE",
      "locationID": 699000000732,
      "lastModified": 1640696561369,
      "flags": [
        "deleted"
      ],
      "latitude": 59.433,
      "longitude": 24.7323
    }
  ],
  "size": 1
}
  • No labels