Class GeoLocationClient

java.lang.Object
com.azure.maps.geolocation.GeoLocationClient

public final class GeoLocationClient extends Object
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 Details

    • getLocation

      public IpAddressToLocationResult getLocation(String ipAddress)
      Get Location
       client.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 Location
       client.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.