As part of the open source address validation project for Infor M3, I just uploaded to the GitHub repository a sample script for Infor Smart Office to validate an address in the US using the United States Postal Service USPS Web Tools API. I provide the script as proof-of-concept for the interested reader to complete to suit their needs.
USPS Web Tools API
The USPS Web Tools API has the Verify and ZipCodeLookup APIs that validate one or more addresses using XML over HTTP GET:
Sample request/response
Here is a sample XML request and the URL:
https://secure.shippingapis.com/ShippingAPI.dll?API=Verify&XML=…
<AddressValidateRequest USERID="************"> <Address> <FirmName>Ciber</FirmName> <Address1>6363 South Fiddlers Green</Address1> <Address2></Address2> <City>Greenwood Village</City> <State>CO</State> <Zip5></Zip5> <Zip4></Zip4> </Address> </AddressValidateRequest>
Here is the XML response:
<?xml version="1.0" encoding="UTF-8"?> <AddressValidateResponse> <Address> <FirmName>CIBER</FirmName> <Address1>STE 1400</Address1> <Address2>6363 S FIDDLERS GREEN CIR</Address2> <City>GREENWOOD VLG</City> <State>CO</State> <Zip5>80111</Zip5> <Zip4>5024</Zip4> </Address> </AddressValidateResponse>
Sample script
Here is the sample script TestUSPS.js in Smart Office:
Here are the resulting XML and HTTP request and response:
That was how to do address validation for M3 in Infor Smart Office for US addresses using USPS Web Tools.
If you like this, please comment, subscribe, share, contribute to the project, donate your code. Thank you.
UPDATE: I would like to specially acknowledge the contribution of William Dale at Augusta Sportswear for allowing me to use his UPS and USPS accounts so I can do my tests and write the scripts. Thank you William!
Thibau i like this and the other address posts. I not only see this as used for validation but also possibly for Data Governance. Cleaning up existing incorrect data should be an activity every company prioritizes. The return on the investment in software systems is greatly reduced when the data your company relies on is incorrect.
LikeLike
Indeed. Ideally, address validation would be integrated in Smart Office, at least as a checkbox to optionally turn on or off, same for phone number and email address validation, just like dates are validated.
LikeLike