To use the database API, you must create a new DatabaseReader using theĭatabaseReader.Builder. getUserType ()) // 'college' Database Usage
getTimeZone ()) // 'America/Chicago' System. getConfidence ()) // 40 Location location = response. getConfidence ()) // 50 Postal postal = response. getConfidence ()) // 90 City city = response. getConfidence ()) // 99 Subdivision subdivision = response. insights ( ipAddress ) Country country = response. getByName ( "128.101.101.101" ) // Do the lookup InsightsResponse response = client. build () InetAddress ipAddress = InetAddress. WebServiceClient client = new WebServiceClient. Please note that the GeoLite2 web service does not support Insights.
Maxmind geoip demo license#
// Replace "42" with your account ID and "license_key" with your license key. Reusing the object will allow it to keep // connections alive for future requests. This creates a WebServiceClient object that is thread-safe and can be // reused across requests. getLongitude ()) // -93.2323 Insights Service getCode ()) // '55455' Location location = response. getName ()) // 'Minneapolis' Postal postal = response. getIsoCode ()) // 'MN' City city = response. get ( "zh-CN" )) // '美国' Subdivision subdivision = response. city ( ipAddress ) Country country = response. getByName ( "128.101.101.101" ) // Do the lookup CityResponse response = client. new WebServiceClient.Builder(42, "license_key").host("").build() WebServiceClient client = new WebServiceClient. To use the GeoLite2 web service instead of the GeoIP2 web service, call the // host method on the builder with "", e.g. See the API documentation for more details. Making multiple requests, the object should be reused so that new connections The WebServiceClient object is safe to share across threads. If the request fails, the client class throws an exception. Which represents part of the data returned by the web service. This model in turn contains multiple record classes, each of If the request succeeds, the method call will return a model class for the end The method corresponding to a specific end point, passing it the IP address After you have created the WebServiceClient, you may then call Set a timeout or set the locales fallback order using the methods on theīuilder. Of GeoIP2, set the host method on the builder to. You must provide the Builder constructor your To use the web service API, you must create a new WebServiceClient using the Should not be used to identify a particular address or household. Any location provided by a GeoIP2 database or web service If you are unable to use Maven or Gradle, you may include the geoip2.jarįile and its dependencies in your classpath.