Package com.azure.maps.geolocation
Class GeoLocationClient
java.lang.Object
com.azure.maps.geolocation.GeoLocationClient
GeoLocationClient
instances are created via the GeoLocationClientBuilder
, as shown below.
Creating a sync client using a AzureKeyCredential
:
// Authenticates using subscription key AzureKeyCredential keyCredential = new AzureKeyCredential(System.getenv("SUBSCRIPTION_KEY")); // Creates a client GeoLocationClient client = new GeoLocationClientBuilder() .credential(keyCredential) .buildClient();
-
Method Summary
Modifier and TypeMethodDescriptiongetLocation
(String ipAddress) Get Locationcom.azure.core.http.rest.Response<IpAddressToLocationResult>
getLocationWithResponse
(String ipAddress, com.azure.core.util.Context context) Get Location
-
Method Details
-
getLocation
Get Locationclient.getLocation("131.107.0.89");
**Applies to**: S0 and S1 pricing tiers.This service will return the ISO country code for the provided IP address. Developers can use this information to block or alter certain content based on geographical locations where the application is being viewed from.
- Parameters:
ipAddress
- The IP address. Both IPv4 and IPv6 are allowed.- Returns:
- this object is returned from a successful call to IP Address to country/region API.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.com.azure.core.exception.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
getLocationWithResponse
public com.azure.core.http.rest.Response<IpAddressToLocationResult> getLocationWithResponse(String ipAddress, com.azure.core.util.Context context) Get Locationclient.getLocation("131.107.0.89");
**Applies to**: S0 and S1 pricing tiers.This service will return the ISO country code for the provided IP address. Developers can use this information to block or alter certain content based on geographical locations where the application is being viewed from.
- Parameters:
context
- The context to associate with this operation.ipAddress
- The IP address. Both IPv4 and IPv6 are allowed.- Returns:
- this object is returned from a successful call to IP Address to country/region API.
- Throws:
IllegalArgumentException
- thrown if parameters fail the validation.com.azure.core.exception.HttpResponseException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-