Quickstart#

Introduction#

Global Address Object corrects, verifies, and enhances Global addresses from over 240 countries.

International address data quality is a challenge for organizations of all sizes. Its differing address structures, terms, and alphabets can have a substantial negative impact on your data-driven initiatives if handled poorly. By using Global Address Object, you’ll reduce undeliverables, increase communication efforts, and save money on all your marketing campaigns.

Sample Code#

Global Address Object is compatible with multiple coding languages across different systems. The table below will link you to the sample code for each language hosted in the github repositories.

Language

System

Repository

C# .NET

Windows

melissa_favicon MelissaData/GlobalAddressObject-Dotnet

melissa_favicon MelissaData/GlobalAddressObject-Dotnet-Wrappers

Python3

Windows

melissa_favicon MelissaData/GlobalAddressObject-Python3

melissa_favicon MelissaData/GlobalAddressObject-Python3-Wrappers

How To Get Data#

Use the Melissa Updater to download the data files using the following manifests:

  • global_dq_data

  • dq_addr_data

  • geocoder_data

  • rf_data

Getting Started#

Basic Flow of Actions#

To use the Global Address Object, you can give it a license, data path, and address. It will then analyze the address and store relevant information about it. It can also return result codes based on the validity of the address.

This is the flow of how Global Address Object is usually implemented:

The Reference Guide goes into detail on every method available with the Global Address Object. All the Result Codes and descriptions are also in the reference guide.

1. Initialize Global Address Object#

Start by creating an instance of the Melissa Global Address Object.

Example Implementation:

  • C#
  • Python3
// Create instance of Melissa Global Address Object
public mdGlobalAddr mdGlobalAddrObj = new mdGlobalAddr();
# Create instance of Melissa Global Address Object
md_global_address_obj = mdGlobalAddr_pythoncode.mdGlobalAddr()

2. Set a License#

To set a license, either configure the environmental variable for the license or use the method SetLicenseString.

Example Implementation:

  • C#
  • Python3
// Set license string
mdGlobalAddrObj.SetLicenseString(MELISSA_LICENSE_STRING);
# Set license string
md_global_address_obj.SetLicenseString(MELISSA_LICENSE_STRING)

To see when the license will expire, use the method GetOutputParameter with the parameter “licenseStringExpirationDate”.

Example Implementation:

  • C#
  • Python3
mdGlobalAddrObj.GetOutputParameter("licenseStringExpirationDate");
md_global_address_obj.GetOutputParameter('licenseStringExpirationDate')

3. Initialize Data Files#

To set the path for the data files, use the method SetPathToGlobalAddrFiles.

To setup the data files, use the method InitializeDataFiles.

ProgramStatus can be used to store the result from InitializeDataFiles in order to ensure it worked as expected.

Example Implementation:

  • C#
  • Python3
// Set data paths for objects
mdGlobalAddrObj.SetPathToGlobalAddrFiles(PATH_TO_DATA_FILES);
mdGlobalAddr.ProgramStatus pStatus = mdGlobalAddrObj.InitializeDataFiles();

// Handle potential issues while initializing the data files
if (pStatus != mdGlobalAddr.ProgramStatus.ErrorNone)
{
    Console.WriteLine("Failed to Initialize Object.");
    Console.WriteLine(pStatus);
    return;
}
# Set data paths for objects
md_global_address_obj.SetPathToGlobalAddrFiles(PATH_TO_DATA_FILES)
p_status = md_global_address_obj.InitializeDataFiles()

# Handle potential issues while initializing the data files
if (p_status != mdGlobalAddr_pythoncode.ProgramStatus.ErrorNone):
    print("Failed to Initialize Object.")
    print(p_status)
    return

To check at what date the database was updated, use the method GetOutputParameter with the parameter “databaseDate”.

To get the development build number of Global Address Object, use the parameter “buildNumber”.

To check the expiration date of the database, use the parameter “databaseExpirationDate”.

Example Implementation:

  • C#
  • Python3
// If you see a different date than expected, check your license string and either
// download the new data files or use the Melissa Updater program to update your data files.
mdGlobalAddrObj.GetOutputParameter("databaseDate");
mdGlobalAddrObj.GetOutputParameter("databaseExpirationDate");

// This number should match with file properties of the Melissa Object binary file.
// If TEST appears with the build number, there may be a license key issue.
mdGlobalAddrObj.GetOutputParameter("buildNumber");
# If you see a different date than expected, check your license string and either
# download the new data files or use the Melissa Updater program to update your data files.
md_global_address_obj.GetOutputParameter('databaseDate')
md_global_address_obj.GetOutputParameter('databaseExpirationDate')

# This number should match with file properties of the Melissa Object binary file.
# If TEST appears with the build number, there may be a license key issue.
md_global_address_obj.GetOutputParameter('buildNumber')

To also get the status on errors in initialization, use the method GetOutputParameter with the parameter “initializeErrorString”. This can help determine if the code should continue running.

Example Implementation:

  • C#
  • Python3
bool shouldContinueRunning = true;

if (globalAddrObject.mdGlobalAddrObj.GetOutputParameter("initializeErrorString") != "No error.")
{
    shouldContinueRunning = false;
}
should_continue_running = True

if address_object.md_global_address_obj.GetOutputParameter("initializeErrorString") != "No error.":
    should_continue_running = False

4. Lookup Global Address#

The method SetInputParameter can set the address for lookup by giving it the following parameter names along with their corresponding values:

  • “inputAddressLine1”

  • “inputAddressLine2”

  • “inputAddressLine3”

  • “inputLocality”

  • “inputAdministrativeArea”

  • “inputPostalCode”

  • “inputCountry”

The method VerifyAddress can verify the address that was set with the previous function.

Example Implementation:

  • C#
  • Python3
mdGlobalAddrObj.SetInputParameter("inputAddressLine1", ADDRESS_LINE_1);
mdGlobalAddrObj.SetInputParameter("inputAddressLine2", ADDRESS_LINE_2);
mdGlobalAddrObj.SetInputParameter("inputAddressLine3", ADDRESS_LINE_3);
mdGlobalAddrObj.SetInputParameter("inputLocality", LOCALITY);
mdGlobalAddrObj.SetInputParameter("inputAdministrativeArea", ADMINISTRATIVE_AREA);
mdGlobalAddrObj.SetInputParameter("inputPostalCode", POSTAL_CODE);
mdGlobalAddrObj.SetInputParameter("inputCountry", COUNTRY);

// This will call the lookup function to process the input
// address as well as generate the result codes
mdGlobalAddrObj.VerifyAddress();
self.md_global_address_obj.SetInputParameter("inputAddressLine1", ADDRESS_LINE_1)
self.md_global_address_obj.SetInputParameter("inputAddressLine2", ADDRESS_LINE_2)
self.md_global_address_obj.SetInputParameter("inputAddressLine3", ADDRESS_LINE_3)
self.md_global_address_obj.SetInputParameter("inputLocality", LOCALITY)
self.md_global_address_obj.SetInputParameter("inputAdministrativeArea", ADMINISTRATIVE_AREA)
self.md_global_address_obj.SetInputParameter("inputPostalCode", POSTAL_CODE)
self.md_global_address_obj.SetInputParameter("inputCountry", COUNTRY)

// This will call the lookup function to process the input
// address as well as generate the result codes
self.md_global_address_obj.VerifyAddress()

5. Get Global Address Object Information#

The method GetOutputParameter can get specific data fields from the Global Address Object, these are some parameters related to the address lookup that can be called:

  • “MAK”

  • “Organization”

  • “addressLine1”

  • “addressline2”

  • “addressline3”

  • “addressline4”

  • “addressline5”

  • “locality”

  • “administrativeArea”

  • “postalCode”

  • “postBox”

  • “countryName”

  • “iso2Code”

  • “iso3Code”

  • “latitude”

  • “longitude”

  • “formattedAddress”

Example Implementation:

  • C#
  • Python3
mdGlobalAddrObj.GetOutputParameter("MAK");
mdGlobalAddrObj.GetOutputParameter("Organization");
mdGlobalAddrObj.GetOutputParameter("addressline1");
mdGlobalAddrObj.GetOutputParameter("addressline2");
mdGlobalAddrObj.GetOutputParameter("addressline3");
mdGlobalAddrObj.GetOutputParameter("addressline4");
mdGlobalAddrObj.GetOutputParameter("addressline5");
mdGlobalAddrObj.GetOutputParameter("locality");
mdGlobalAddrObj.GetOutputParameter("administrativeArea");
mdGlobalAddrObj.GetOutputParameter("postalCode");
mdGlobalAddrObj.GetOutputParameter("postBox");
mdGlobalAddrObj.GetOutputParameter("countryName");
mdGlobalAddrObj.GetOutputParameter("iso2Code");
mdGlobalAddrObj.GetOutputParameter("iso3Code");
mdGlobalAddrObj.GetOutputParameter("latitude");
mdGlobalAddrObj.GetOutputParameter("longitude");
mdGlobalAddrObj.GetOutputParameter("formattedAddress");
md_global_address_obj.GetOutputParameter("MAK")
md_global_address_obj.GetOutputParameter("Organization")
md_global_address_obj.GetOutputParameter("addressLine1")
md_global_address_obj.GetOutputParameter("addressLine2")
md_global_address_obj.GetOutputParameter("addressLine3")
md_global_address_obj.GetOutputParameter("addressLine4")
md_global_address_obj.GetOutputParameter("addressLine5")
md_global_address_obj.GetOutputParameter("Locality")
md_global_address_obj.GetOutputParameter("AdministrativeArea")
md_global_address_obj.GetOutputParameter("postalCode")
md_global_address_obj.GetOutputParameter("postBox")
md_global_address_obj.GetOutputParameter("countryName")
md_global_address_obj.GetOutputParameter("iso2Code")
md_global_address_obj.GetOutputParameter("iso3Code")
md_global_address_obj.GetOutputParameter("Latitude")
md_global_address_obj.GetOutputParameter("Longitude")
md_global_address_obj.GetOutputParameter("formattedAddress")

6. Get the Melissa Result Codes#

In order to get the result codes, call the method GetOutputParameter with the parameter “resultCodes”. This will return all of the result codes stacked together in a single String separated by ‘,’ delimiters.

The result codes and their corresponding descriptions are in the Reference Guide: Result Codes.

Example Implementation:

  • C#
  • Python3
string ResultCodes = mdGlobalAddrObj.GetOutputParameter("resultCodes");
result_codes = md_global_address_obj.GetOutputParameter("resultCodes")