The address to retrieve is identified by the addressKey parameter, which should be taken from the ID of a PartialAddress that has been returned from one of these methods.
The returned address can be formatted in a number of different ways. Please refer to the address formatting page for further details.
<!-- 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 AddressCapture Integr8 service
data8.load('AddressCapture');
}
function FetchAddress(licence, addressKey) {
/// <param name="licence">string. One of the following values: WebServerFull, WebClickFull, WebClickThoroughfare, InternalUserFull, InternalUserThoroughfare, SmallUserFull, SmallUserThoroughfare, Lookup, InternalServerFull, InternalServerThoroughfare, FreeTrial, FreeTrialThoroughfare, InternalUserFullArea, InternalUserThoroughfareArea, WebServerThoroughfare</param>
/// <param name="addressKey">string</param>
var addresscapture = new data8.addresscapture();
addresscapture.fetchaddress(
licence,
addressKey,
null,
showFetchAddressResult
);
}
function showFetchAddressResult(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.ResultCount
// Contains the number of addresses in the Results field. This field is only populated if the ReturnResultCount option is set to True
// result.Results
// Contains an array of addresses that match the query.
// A formatted version of each address in the array is available in the Address field,
// and a structured version of the address is available in the RawAddress field.
}
}
loadIntegr8();
</script>
// NOTE: A reference to the web service must be added to use this sample code.
// See the details at:
// https://www.data-8.co.uk/developers/how-to/-net-1-0-1-1-and-2-0-web-references
// or
// https://www.data-8.co.uk/developers/how-to/-net-3-5-and-later-service-references
private void FetchAddress(AddressCaptureLicence licence, string addressKey)
{
// Invoke the web service method.
AddressCaptureSoapClient proxy = new AddressCaptureSoapClient();
AddressOutput results = proxy.FetchAddress("username", "password", licence, addressKey, null);
// Check that the call succeeded, and show the error message if there was a problem.
if ((results.Status.Success == false))
{
MessageBox.Show(("Error: " + results.Status.ErrorMessage));
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// result.ResultCount
// Contains the number of addresses in the Results field. This field is only populated if the ReturnResultCount option is set to True
// result.Results
// Contains an array of addresses that match the query.
// A formatted version of each address in the array is available in the Address field,
// and a structured version of the address is available in the RawAddress field.
}
}
'NOTE: A reference to the web service must be added to use this sample code.
'See the details at:
'https://www.data-8.co.uk/developers/how-to/-net-1-0-1-1-and-2-0-web-references
'or
'https://www.data-8.co.uk/developers/how-to/-net-3-5-and-later-service-references
Private Sub FetchAddress(ByVal licence As AddressCaptureLicence, ByVal addressKey As String)
'Invoke the web service method.
Dim proxy As AddressCaptureSoapClient = New AddressCaptureSoapClient()
Dim results As AddressOutput = proxy.FetchAddress("username", "password", licence, addressKey, Nothing)
'Check that the call succeeded, and show the error message if there was a problem.
If (results.Status.Success = false) Then
MessageBox.Show(("Error: " + results.Status.ErrorMessage))
Else
'TODO: Process method results here.
'Results can be extracted from the following fields:
'result.ResultCount
' Contains the number of addresses in the Results field. This field is only populated if the ReturnResultCount option is set to True
'result.Results
' Contains an array of addresses that match the query.
' A formatted version of each address in the array is available in the Address field,
' and a structured version of the address is available in the RawAddress field.
End If
End Sub
// NOTE: The php_soap.dll extension must be enabled in the php.ini file.
function FetchAddress($licence, $addressKey)
{
$params = array(
"username" => "your-username",
"password" => "your-password",
"licence" => $licence,
"addressKey" => $addressKey,
"options" => $options
);
$client = new SoapClient("https://webservices.data-8.co.uk/AddressCapture.asmx?WSDL");
$result = $client->FetchAddress($params);
if ($result->FetchAddressResult->Status->Success == 0)
{
echo "Error: " . $result->FetchAddressResult->Status->ErrorMessage;
}
else
{
// TODO: Process method results here.
// Results can be extracted from the following fields:
// $result->FetchAddressResult->ResultCount
// Contains the number of addresses in the Results field. This field is only populated if the ReturnResultCount option is set to True
// $result->FetchAddressResult->Results
// Contains an array of addresses that match the query.
// A formatted version of each address in the array is available in the Address field,
// and a structured version of the address is available in the RawAddress field.
// NOTE: This field contains an array of items, but if it contains only one item,
// PHP may not recognise it as an array. To always extract the result of this
// field as an array, we recommend you always access it using the
// getArrayFromResponse method described at
// http://www.php.net/soap_soapclient_soapcall#75797, e.g.
// foreach (getArrayFromResponse($result->FetchAddressResult->Results) as $item)
// {
// ...
// }
}
}
Post requests to the JSON endpoint: https://webservices.data-8.co.uk/AddressCapture/FetchAddress.json
Requests can be authenticated in any of three ways:
API Key - include the key on the URL as ?key=your-ajax-api-key query string
JWT token - acquire a JWT token from the GetJWT method on the UserAdmin service and include it in a Authorization: Bearer your-jwt-token HTTP header
Username & password - include your Data8 username and password as additional properties in the JSON request body
Public Sub FetchAddress(licence As String, addressKey As String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "https://webservices.data-8.co.uk/recordset.ashx?service=AddressCapture&method=FetchAddressSimple" &
"&username=your-username" &
"&password=your-password" &
"&licence=" & licence &
"&addressKey=" & addressKey
If rs.MoveFirst Then
If rs.Fields(0).Name = "Success" And rs.Fields(0).Value = false Then
MsgBox "Error: " & rs.Fields(1)
Else
'TODO: Process method results here.
'All the results are available in the first row in the recordset.
'Results can be extracted from the following fields:
'ResultCount
' Contains the number of addresses in the Results field. This field is only populated if the ReturnResultCount option is set to True
'Each result is available in a different row in the recordset.
'Results can be extracted from the following fields:
'RawAddress_Organisation
'RawAddress_Department
'RawAddress_AddressKey
'RawAddress_OrganisationKey
'RawAddress_PostcodeType
'RawAddress_BuildingNumber
'RawAddress_SubBuildingName
'RawAddress_BuildingName
'RawAddress_DependentThoroughfareName
'RawAddress_DependentThoroughfareDesc
'RawAddress_ThoroughfareName
'RawAddress_ThoroughfareDesc
'RawAddress_DoubleDependentLocality
'RawAddress_DependentLocality
'RawAddress_Locality
'RawAddress_Postcode
'RawAddress_Dps
'RawAddress_PoBox
'RawAddress_PostalCounty
'RawAddress_TraditionalCounty
'RawAddress_AdministrativeCounty
'RawAddress_CountryISO2
'RawAddress_UniqueReference
'RawAddress_Location_Easting
'RawAddress_Location_Northing
'RawAddress_Location_GridReference
'RawAddress_Location_Longitude
'RawAddress_Location_Latitude
'RawAddress_Location_CountyCode
'RawAddress_Location_County
'RawAddress_Location_DistrictCode
'RawAddress_Location_District
'RawAddress_Location_WardCode
'RawAddress_Location_Ward
'RawAddress_Location_Country
End If
End If
End Sub