0151 355 4555

CleanAddress

Description

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

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 - The address provided has been cleansed successfully however a match could not be found within the UK.

View all 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 Postcoder Integr8 service
  data8.load('Postcoder');
}

function CleanAddress(address) {
  /// <param name="address">data8.address. Set up the Lines properties before calling this method.</param>
  var postcoder = new data8.postcoder();
  
  postcoder.cleanaddress(
    address,
    null,
    showCleanAddressResult
  );
}

function showCleanAddressResult(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.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>