23. May 2008 18:47
I was in need of querying some sort of database or web service to clean up a user entered address. I was going to go the route of screen scraping, but after doing some research I read in the USPS Web Site about their Web Tools and their Address Information APIs (AIA). Under the AIA you have 3 tools: Address Standardization, Zip Code Lookup, and City/State Lookup. I was in need of Address Standardization, so I started reading. Their process and documentation did not seem so straightforward so here is a more simplified help on how to do it.
Register for their service. You will get an email with a username and password. Everywhere in their documentation they mention UserID and they are referring to the username you received in the email.
Read the documentation. The Development Guide did not get me much. Since I was interested in Address Verification I read the Address Verification.
The way their API works is you generate an HTTP request with 2 parameters to the address specified in the email. The 2 parameters are the application you want to query and an XML containing your UserID (username) and the address you want to verify. Please read the documentation for more details on the schema of the XML. It is very simple! The response of this request will contain another XML specifying the result, whether there was an error or the correct address.
Test the API and make sure it works.
Call the Customer Service phone specified in the docs (or the website) and ask them to switch your UserID (username) to production. They will send you another email and all you have to do is change the URL to the production one.
Happy Address Verification!