Objective: As part of the “Build 14 Websites…” course exploring the Google Address API, we were challenged to do our own address lookup page.
However, I first explored the U.S. Postal Service (USPS) Address lookup API and created a web page for that before proceeding with Google.
1.) Both web pages support test data. Since both USPS and Google can charge for or restrict use of the APIs and since test data enables efficiently exercising features without repeatedly hitting the API, test cases are important.
In the USPS version the test data is embedded in the code. In the Google version, however the test data is saved in files which I think is an improvement. Enter “test0” through “test3” (in the Zip Code field for USPS) to access the test cases.
2.) Both USPS and Google APIs may return a postal code suffix field. The absence of this field is an indicator that the address is likely not deliverable by the U.S. Postal Service. Perhaps there is no house with that number or in some rural communities the Postal Carrier may not service the entire road. In both pages, if the suffix was included, I added it to the display for U.S. addresses or indicated the address may be undeliverable. During testing I found an address I know is deliverable by USPS for which USPS returned the postal code suffix, but Google did not. In the U.S. the postal code with the suffix is commonly known as “Zip Plus 4”.
3.) Both pages use PHP as a way to keep the API User IDs private. PHP also has handy functions for loading test data.
4.) Some Google API specific features:
a. The page using the Google API, handles retrieving multiple addresses for a search.
b. The found addresses are links to Google Maps.
c. Hovering on the link showed information about locale like “Town, County, State, Country”.
Source Code: (See address-checker folder)
The intention of this example is to show initiative in exploring alternate solutions. It shows consideration of live APIs by moving test cases to self hosted test data. It also shows observance of data and a drive to discover and utilize valuable features.