API for Address Matching

Window Book, as of September 2020, offers an API that is called using C++. We also have examples of C# and Java. Client Services can provide an XML that includes all the possible input fields, with valuable address match output fields, which will be discussed here. The TrueAddress (TA) API allows users to store the results of a single address match to memory and choose what to display to the end user, instead of address matching in batch and outputting to a file.

As long as you have efficient multithreading and decent processor speed and cores, the overhead from C# and Java should not impact the ability to have really high throughput. The underlying engine for the API is exactly the same as for batch, so you should get close to the same speed: around 20,000 calls per second.

API Directory

The main directory …’WB/TrueAddress/API’ and mentioned above we have examples of using C# and Java to call the API.

API Header (TrueAddress_API.h)

“TrueAddress_API.h” is the API header file that must be invoked to match an address. We provide a template job XML that allows communication from your program to TA. What you are doing is passing an address into the TA module to match and return detailed results.

The following function should be called once at the start of the processing and before any other functions are called. The parameters are the names of the XML files and the path where the program should be started (for IIS).

TrueAddress_Start(char *config_xml, char *job_xml, char* execution_path);

This function allows retrieval of job parameters after initialization, including custom fields defined in the XML files. Success means the field was found, even though the value may be empty.

TrueAddress_Get_Field(char *field_name, char *field_value, int max_len);

Perform CASS processing on the input record and return the results in the output record. The record formats are defined in the job XML as with the batch processing. If thread_num is >= 0 the allocated TA thread will be used, -1 indicates that TA will find an available thread, waiting for availability if necessary. Errors should be extremely rare, but always considered fatal.

TrueAddress_Process_Record(char *input_record, char *output_record, int thread_num);

Return the next report defined for Job_End. Calling this function implies that record processing has finished. Success means a report was created, and failure that either there was an error or no more reports were defined.

TrueAddress_Get_Report(char *report_record, int max_len);

Finish processing and terminate TA.

TrueAddress_End();

Return an error message, if any.

TrueAddress_Get_Error(char *error_msg, int max_len);

Job XML

This is an example of a job XML for the input fields that must be passed to TA. At a minimum, one address line, city, state, and zip must be presented.

Copy

Job XML - Input Fields

<Input_File Record_Type="Input" Delimiter="Tab" File_Format="Delimited" >
    <File_Name>Memory</File_Name>
    <Field Name = "Address_ID" Column = "1"/>
    <Field Name = "Address_Line_1" Column = "+1"/>
    <Field Name = "Address_Line_2" Column = "+1" />
    <Field Name = "City"  Column = "+1" />
    <Field Name = "State" Column = "+1" />
    <Field Name = "ZIP_Code"  Column = "+1" />
    <Field Name = "Firm_Name"  Column = "+1" />
    <Field Name = "Last_Line" Column = "+1" />
    <Field Name = "Urbanization" Column = "+1" />
  </Input_File>

This is a sample of some of the output fields that may be of use to your application. See Additional References for links to the address matching fields.

Copy

Job XML - Output Fields

<Field Name = "Deliverability_Score" Length = "1" Column = "+1" />
<Field Name = "USPS_Score" Length = "1" Column = "+1" />
<Field Name = "Non_USPS_Score" Length = "1" Column = "+1" />
<Field Name = "RDI" Column = "+1" />
<Field Name = "DPV_Confirm"  Column = "+1" />
<Field Name = "DPV_Footnotes" Column = "+1" />
<Field Name = "ZIP4_Footnotes" Column = "+1" />
<Field Name = "LACSLink_Return_Code" Column = "+1" />
<Field Name = "SuiteLink_Return_Code" Column = "+1" />
<Field Name = "ZIP4_Record_Type" Column = "+1" />
<Field Name = "DPV_CMRA_Flag"  Column = "+1" />
<Field Name = "DPV_PBSA_Flag"  Column = "+1" />
<Field Name = "DPV_Vacant_Flag"  Column = "+1" />
<Field Name = "DPV_Nostats_Flag" Column = "+1" />

Return to Additional References