Skip to main content

Capture Sample Code


Are you compatible with TLS 1.2?
Test your connections as soon as possible to avoid service disruptions. 

Overview

Capture RESTful sample code is a collection of integration examples for the following Experian Data Quality products:

The code is implemented using htmlJavascriptcss, and C# which requires .NET framework 4.0.

To use the sample code: 

1. Get the files:  Download ZIP

2. Authenticate with a token. Retrieve your token from Self Service Portal Licenses. You may have to generate multiple tokens if you have more than one Experian Data Quality product.

Enter token details

Each product has a designated file used for authentication, found in the sample code package:

Address Validate > addressValidation.ashx
Phone Validate > phoneValidation.ashx
Email Validate > emailValidation.ashx

1. Open the appropriate ashx file (e.g. addressValidation.ashx) with any text editor.

2. Paste your token as the AuthToken value, for example:

//***Enter your token as AuthToken value***
//NOTE: Get tokens from https://portal.experianmarketingservices.com

private const string AuthToken = "70ba48b1-f8a2-447e-9d7c-4afdde28ef50";

3. Save and close the file.

3. Start using the code.

Here's a sample integration of phone, email, and address (with Verification workflow):

Address validate

Capture sample code provides three address search workflows: Singleline, Verification and Intuitive.

Address Search WorkflowJavascript FileSupported Dataset
Singleline (default) singleline.js GBR only
Intuitive intuitive.js USA only
Verification verification.js USA & CAN only

Depending on the selected workflow, sample.html may render additional html elements.

Switching between workflows

1. Open sample.html using any text editor.
2. In <head> find the following section:

<!-- ***To enable address validation***
Comment and uncomment the scripts below to toggle between singleline, verification and intuitive address workflows.
NOTE: Only one of these scripts should be enabled at any one time.-->

<script type="text/javascript" src="js/singleline.js"></script>
<!--<script type="text/javascript" src="js/verification.js"></script>--> <!--<script type="text/javascript" src="js/intuitive.js"></script>--> 

3. Comment / uncomment the required script to toggle between the available workflows.

Singleline

The Singleline workflow provides address search in Singleline mode where an address can be searched on by entering it in a single textbox. Once this workflow is enabled, sample.html will render additional html elements:

Simple integration

These are advanced options for singleline.js:

OptionDescription
proxyPath Path pointing to the address proxy file.
timeout Timeout in milliseconds (ms) for the call to the proxy file.
country Default country to search for an address on.
styles CSS style classes used by the singleline.js plugin to generate the HTML.
messages Messages to display in the generated HTML by the singleline.js plugin.
onSuccess Success handler that will be called whenever the address search is successful.
onError Error handler that will be called when there an error occurs while performing an address search.

Example: 

$("#container").singlelineSearch({
     proxyPath: "addressValidation.ashx",
     timeout: 10000,
     country: "GBR",
     styles: {
            searchBoxLabel: "searchBoxLabel",
            searchBox: "searchBox",
            searchButton: "searchButton",
            resultContainer: "resultContainer",
            picklist: "picklist",
            picklistItem: "picklistItem",
            picklistItemText: "picklistItemText",
            loadingIndicator: "loading",
            errorIndicator: "errorImg"
     },
     messages: {
            label: {
                  searchBox: "Enter Search"
            },
            button: {
                  searchBox: "Search"
            },
            search: {
                  noAddressEntered: "Please enter address to begin searching.",
                  notFound: "Address not found."
            },
            error: {
                  error: "Please contact Experian support.",
                  timeout: "Timeout."
            }
     },
     onSuccess: function (data) {
     // onSuccess callback implementation
     },
     onError: function (jqXHR, status, errThrown) {
     // onError callback implementation
     }
});

Intuitive

The Intuitive workflow allows you to search as you type, using a single textbox. Once this workflow is enabled, sample.html will render additional html elements:

 

Simple integration

These are advanced options for intuitive.js:

OptionDescription
proxyPath Path pointing to the address proxy file.
timeout Timeout in milliseconds (ms) for the call to the proxy file.
country Default country to search for an address on.
styles CSS style classes used by the intuitive.js plugin to generate the HTML.
messages Messages to display in the generated HTML by the intuitive.js plugin.
onPreSearch Handler that will be called before triggering the address validation.
onSuccess Success handler that will be called whenever the address search is successful.
onError Error handler that will be called when there an error occurs while performing an address search.

Example: 

$("#container").intuitiveSearch({
     proxyPath: "addressValidation.ashx",
     country: "USA",
     styles: {
            searchBox: "searchBox",
searchBoxLabel: "searchBoxLabel", resultContainer: "resultContainer", picklist: "picklist", picklistItem: "picklistItem", picklistItemText: "picklistItemText",
refineContainer: "refineContainer",
refineHeader: "refineHeader",
refineText: "refineText",
refineBox: "refineBox",
refineButton: "refineButton",
refineError: "refineError", loadingIndicator: "loading", errorIndicator: "errorImg" }, messages: { search: { continueTyping: "Continue Typing..." },
interactionRequired: { header: "We think that your address may be incorrect or incomplete.",
text: "We recommend:",
button: "Use suggested address"
  }, premisePartial: { header: "Sorry, we think your apartment/suite/unit is missing or wrong.", text: "Confirm your Apartment/Suite/Unit number:", button: "Confirm number", error: "Secondary information not within valid range" }, streetPartial: { header: "Sorry, we do not recognize your house or building number.", text: "Confirm your House/Building number:", button: "Confirm number", error: "Primary information not within valid range" }, multiple: { header: "We found more than one match for your address.", text: "Our suggested matches:", },
error: { error: "Please contact Experian support.", timeout: "Timeout." } }, onSuccess: function (data) { // onSuccess callback implementation }, onError: function (jqXHR, status, errThrown) { // onError callback implementation } });

Verification

The Verification workflow allows you to verify addresses via a formatted form. See sample.html for an example.

Simple integration

1. Import verification.js to your html page:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
     <title>Verification Address Search</title>
     <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
     <script type="text/javascript" src="js/intuitive.js"></script>
</head>
<body>
</body>
</html> 

2. Enhance your form with inputAddress and inputCountry classes:

  • inputAddress will be used to indicate that the element’s value is part of the address to verify.
  • inputCountry will be used to indicate that the element’s value is the country to verify against.
<body>
  <form>
    <p>
        <label style="width:10em; display:inline-block">Address Line 1</label>
        <input type="text" class="inputAddress"/>
    </p>
    <p>
        <label style="width:10em; display:inline-block">Address Line 2</label>
        <input type="text" class="inputAddress"/>
    </p>
    <p>
        <label style="width:10em; display:inline-block">Address Line 3</label>
        <input type="text" class="inputAddress"/>
    </p>
    <p>
        <label style="width:10em; display:inline-block">City/Town</label>
        <input type="text" class="inputAddress"/>
    </p>
    <p>
        <label style="width:10em; display:inline-block">State/County/Province</label>
        <input type="text" class="inputAddress"/>
    </p>
    <p>
       <label style="width:10em; display:inline-block">Zipcode/Postcode</label>
       <input type="text" class="inputAddress"/>
    </p>
    <p>
        <label style="width:10em; display:inline-block">Country</label>
        <select class="inputCountry">
           <optionvalue="CAN">CAN</option>
           <optionvalue="USA">USA</option>
        </select>
    </p>
  </form>
</body>

3. Define an <input> button after the <form> in the Html page. The <input> button will be used to trigger the address verification.

4. Define a <div> element after the <input> button. The <div> element will be the container of the UI elements that will be auto-generated by the intuitive.js script. In this instance, it is named as “container”.

   </form>
<input id="buttonSubmit" type="button" value="Submit" />
<div id="container"></div>
</body>

5. Initialize the search by selecting the <div> element and calling the verificationSearchfunction followed by binding the <input> button’s click event to call the verify function.

6. Assign both the onSuccessHandler and onErrorHandler functions:

  • onSuccess will be called whenever the address is validated
  • onError will be called whenever there is an error in validating the address 
<input id="buttonSubmit" type="button" value="Submit" />
<div id="container"></div>
<script type="text/javascript">
  $(document).ready(function() {
    var $plugin = $("#container").verificationSearch({
        onSuccess: onSuccessHandler,
        onError: onErrorHandler
        });
    $("#buttonSubmit").click(function() {
        $plugin.verify();
        });
    function onSuccessHandler(data) {
        var $addresses = $(".inputAddress");
        // Success callback implementation
        $.each(data.fields,function (index, value) {
        var $current = $($addresses[index]);
        $current.val(value.content);
        });
    };
    function onErrorHandler(jqXHR, status, errThrown) {
        // Error callback implementation
    };
  });
</script>

 7. The completed page will look something like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Verification Address Search</title>
    <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="js/verification.js"></script>
</head>
<body>
    <form>
        <p>
            <label style="width:10em; display:inline-block">Address Line 1</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">Address Line 2</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">Address Line 3</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">City/Town</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">State/County/Province</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">Zipcode/Postcode</label>
            <input type="text" class="inputAddress"/>
        </p>
        <p>
            <label style="width:10em; display:inline-block">Country</label>
            <select class="inputCountry">
                <optionvalue="CAN">CAN</option>
                <optionvalue="USA">USA</option>
            </select>
        </p>
    </form>
    <input id="buttonSubmit" type="button" value="Submit" />
    <div id="container"></div>
    <script type="text/javascript">
        $(document).ready(function() {
            var $plugin = $("#container").verificationSearch({
                onSuccess: onSuccessHandler,
                onError: onErrorHandler
                });
        $("#buttonSubmit").click(function() {
            $plugin.verify();
            });
        function onSuccessHandler(data) {
            var $addresses = $(".inputAddress");
            // Success callback implementation
            $.each(data.fields,function(index, value) {
            var $current = $($addresses[index]);
            current.val(value.content);
            });
        };
        function onErrorHandler(jqXHR, status, errThrown) {
            // Error callback implementation
            };
        });
    </script>
</body>
</html>

8. Test your implementation by entering your address in the generated textbox:

See Address Validate REST API guide for more information about the format of ‘data’ in the onSuccessHandler function callback.

Advanced Options

These are advanced options for verification.js:

OptionDescription
proxyPath Path pointing to the address proxy file.
timeout Timeout in milliseconds (ms) for the call to the proxy file.
inputAddress CSS class that marks which textbox will be used as part of the address to validate against.
inputCountry CSS class that marks which textbox will be used as the country to validate against.
styles CSS style classes used by the verification.js plugin to generate the HTML.
messages Messages to display in the generated HTML by the verification.js plugin
onSuccess Success handler that will be called whenever the address search is successful.
onError Error handler that will be called when there an error occurs while performing an address search.

Example: 

$("#container").verificationSearch({
  proxyPath: "addressValidation.ashx",
  timeout: 10000,
  inputAddress: "inputAddress",
  inputCountry: "inputCountry",
  styles: {
    resultContainer: "resultContainer",
    picklist: "picklist",
    picklistItem: "picklistItem",
    picklistItemText: "picklistItemText",
    refineContainer: "refineContainer",
    refineHeader: "refineHeader",
    refineText: "refineText",
    refineBox: "refineBox",
    refineButton: "refineButton",
    refineError: "refineError",
    loadingIndicator: "loading",
    errorIndicator: "errorImg"
  },
  messages: {
    interactionRequired: {
        header: "We think that your address may be incorrect or incomplete.",
        text: "We recommend:",
        button: "Use suggested address"
    },
    premisePartial: {
        header: "Sorry, we think your apartment/suite/unit is missing or wrong.",
        text: "Confirm your Apartment/Suite/Unit number:",
        button: "Confirm number",
        error: "Secondary information not within valid range"
    },
    streetPartial: {
        header: "Sorry, we do not recognize your house or building number.",
        text: "Confirm your House/Building number:",
        button: "Confirm number",
        error: "Primary information not within valid range"
    },
    multiple: {
        header: "We found more than one match for your address.",
        text: "Our suggested matches:",
    },
    verify: {
        notVerified: "Address could not be verified.",
    }
    error: {
        error: "Please contact Experian QAS support.",
        timeout: "Timeout."
    }
  },
  onSuccess: function (data) {
  // onSuccess callback implementation
  },
  onError: function (jqXHR, status, errThrown) {
  // onError callback implementation
  }
});

Email validate

Email Validate provides email address validation service that returns the status of the validated email address. Before starting, open sample.html file in any text editor and ensure that email.js script is uncommented:

<script type="text/javascript" src="js/email.js"></script>

Phone validate

Phone Validate provides a global phone validation service. We currently support over 160 countries. Before starting, open sample.html file in any text editor and ensure that phone.js script is uncommented:

<script type="text/javascript" src="js/phone.js"></script>

Troubleshooting

SSL certificate errors

Your SSL certificate might have expired. To manually update your deployment:
  1. Download the update files.
  2. Extract the files.
  3. Install Root.crt in the Trusted Root Certificates Authorities Store.
  4. Install Intermediate1.crt and Intermediate2.crt  in the Intermediate Certificate Authorities Store.
  5. Install api.experianmarketingservices.com.cer in the Personal Certificate Store.

For further help contact support.