Skip to content

Commit c3a04c7

Browse files
authored
Merge pull request #236 from maxmind/greg/geolite-ws
Document how to use the GeoLite2 web service
2 parents e028989 + 8116f9a commit c3a04c7

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ should not be used to identify a particular address or household.
5151

5252
To use the web service API, you must create a new `WebServiceClient` using the
5353
`WebServiceClient.Builder`. You must provide the `Builder` constructor your
54-
MaxMind `accountId` and `licenseKey`. You may also set a `timeout`, specify a
55-
specific `host`, or set the `locales` fallback order using the methods on the
54+
MaxMind `accountId` and `licenseKey`. To use the GeoLite2 web services instead
55+
of GeoIP2, set the `host` method on the builder to `geolite.info`. You may also
56+
set a `timeout` or set the `locales` fallback order using the methods on the
5657
`Builder`. After you have created the `WebServiceClient`, you may then call
5758
the method corresponding to a specific end point, passing it the IP address
5859
you want to look up.
@@ -82,6 +83,9 @@ See the API documentation for more details.
8283
// it should not be closed until you are finished making requests with it.
8384
//
8485
// Replace "42" with your account ID and "license_key" with your license key.
86+
// To use the GeoLite2 web service instead of GeoIP2 Precision, call the
87+
// host method on the builder with "geolite.info", e.g.
88+
// new WebServiceClient.Builder(42, "license_key").host("geolite.info").build()
8589
try (WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
8690
.build()) {
8791

@@ -106,6 +110,9 @@ try (WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
106110
// it should not be closed until you are finished making requests with it.
107111
//
108112
// Replace "42" with your account ID and "license_key" with your license key.
113+
// To use the GeoLite2 web service instead of GeoIP2 Precision, call the
114+
// host method on the builder with "geolite.info", e.g.
115+
// new WebServiceClient.Builder(42, "license_key").host("geolite.info").build()
109116
try (WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
110117
.build()) {
111118

@@ -144,6 +151,7 @@ try (WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
144151
// it should not be closed until you are finished making requests with it.
145152
//
146153
// Replace "42" with your account ID and "license_key" with your license key.
154+
// Please note that the GeoLite2 web service does not support Insights.
147155
try (WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
148156
.build()) {
149157

src/main/java/com/maxmind/geoip2/WebServiceClient.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@
5353
* To use the web service API, you must create a new {@code WebServiceClient}
5454
* using the {@code WebServiceClient.Builder}. You must provide the
5555
* {@code Builder} constructor your MaxMind {@code accountId} and
56-
* {@code licenseKey}. You may also set a {@code timeout}, specify a specific
57-
* {@code host}, or set the {@code locales} fallback order using the methods
58-
* on the {@code Builder}. After you have created the {@code WebServiceClient},
59-
* you may then call the method corresponding to a specific end point, passing
60-
* it the IP address you want to look up.
56+
* {@code licenseKey}. To use the GeoLite2 web services instead of GeoIP2, set
57+
* the {@code host} method on the builder to {@code geolite.info}. You may also
58+
* set a {@code timeout} or set the {@code locales} fallback order using the
59+
* methods on the {@code Builder}. After you have created the
60+
* {@code WebServiceClient}, you may then call the method corresponding to a
61+
* specific end point, passing it the IP address you want to look up.
6162
* </p>
6263
* <p>
6364
* If the request succeeds, the method call will return a model class for the
@@ -150,9 +151,7 @@ private WebServiceClient(Builder builder) {
150151
* with the {@code Builder}:
151152
* </p>
152153
* <p>
153-
* WebServiceClient client = new
154-
* WebServiceClient.Builder(12,"licensekey").host
155-
* ("geoip.maxmind.com").build();
154+
* {@code WebServiceClient client = new WebServiceClient.Builder(12,"licensekey").host("geoip.maxmind.com").build();}
156155
* </p>
157156
* <p>
158157
* Only the values set in the {@code Builder} constructor are required.
@@ -203,7 +202,8 @@ public WebServiceClient.Builder disableHttps() {
203202
}
204203

205204
/**
206-
* @param val The host to use.
205+
* @param val The host to use. Set this to {@code geolite.info} to use the
206+
* GeoLite2 web service instead of GeoIP2 Precision.
207207
* @return Builder object
208208
*/
209209
public Builder host(String val) {

0 commit comments

Comments
 (0)