DetectCountry
 

DetectCountry

Definition

CountryDetectionOutput DetectCountry ( string username, string password, CountryDetectionInput request, Option[] options )

Description:

Identifies a country from a customer's contact details. All the available details for the customer should be supplied as part of the CountryDetectionInput structure passed as the request argument.

The details of the country are provided in the returned CountryDetectionOutput structure. If no country could be identified, the country name and ISO code are both set to "Unknown".

View all Country Detection Methods

Code Samples

Language:

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>

<script type="text/javascript">

function loadIntegr8() {
  // Load the CountryDetection Integr8 service
  data8.load('CountryDetection');
}

function DetectCountry(request) {
  /// <param name="request">data8.countrydetectioninput. Set up the Address, Postcode, Country, EmailAddresses, TelephoneNumbers properties before calling this method.</param>
  var countrydetection = new data8.countrydetection();
  
  countrydetection.detectcountry(
    request,
    null,
    showDetectCountryResult
  );
}

function showDetectCountryResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  }
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.CountryName
    //   Contains the ISO standard name of the detected country
    // result.CountryISO
    //   Contains the 2-character ISO code of the detected country
  }
}

loadIntegr8();

</script>
Skip Navigation Links
Request handled by server S1 for client 38.107.179.218 at 22/05/2012 23:03:13