0151 355 4555

CleanBusinessAddress

Description

Formats, verifies and corrects a given address into a full business address.

The country parameter is used as a guide to which country the address should be treated as being in to help the cleansing process. This must be supplied as an ISO 2-character code, e.g. GB for Great Britain, US for the United States, DE for Germany etc. The name and ISO 2-character code for the country the service finally determines the address to belong to are returned as part of the output.

A MatchLevel is also provided, explaining any action taken on supplied address. These are:

OK_Unchanged - The address provided has been cleansed successfully and was verified to be correct. No modifications have been made.

OK_Corrected - The address provided has been cleansed successfully and was verified to be correct. Modifications have had to be made in order to make the address correct.

NOK_Building - The address provided has been cleansed successfully however it was only found to be correct to a building level.

NOK_Street - The address provided has been cleansed successfully however it was only found to be correct to a street level.

NOK_Town - The address provided has been cleansed successfully however it was only found to be correct to a town level.

NOK_NoMatch - No match for the supplied address details could be found.

View all International Postcoder (contact us for more information about this service) methods

Code Samples

<!-- 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="https://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>

<script type="text/javascript">

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

function CleanBusinessAddress(company, address, country) {
  /// <param name="company">string</param>
  /// <param name="address">data8.address. Set up the Lines properties before calling this method.</param>
  /// <param name="country">string</param>
  var internationalpostcoder = new data8.internationalpostcoder();
  
  internationalpostcoder.cleanbusinessaddress(
    company,
    address,
    country,
    null,
    showCleanBusinessAddressResult
  );
}

function showCleanBusinessAddressResult(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.Result
    //   Contains the formatted version of the requested address in the Address field,
    //   and a structured version of the address in the RawAddress field.
    // result.CountryName
    //   Contains the ISO standard name of the detected country
    // result.CountryISO
    //   Contains the 2-character ISO code of the detected country
    // result.MatchLevel
    //   Contains a MatchLevel to indicate how well the address matched to PAF. Possible values are OK_Unchanged, OK_Corrected, NOK_Building, NOK_Street, NOK_Town, NOK_NoMatch
  }
}

loadIntegr8();

</script>