USPS CityStateLookup question

danpman
danpman used Ask the Experts™
on
I'm attempting to use the USPS CityStateLookup API and find that it is only returning the 'primary' city associated with a ZIP code.  If there are multiple cities or counties that are covered by a single ZIP code, they are not getting returned.  

Am I missing something in the request?

XML=<CityStateLookupRequest USERID="114STRAT2854">
<ZipCode ID="1">
<Zip5>65202</Zip5>
</ZipCode>
</CityStateLookupRequest>

The response below contains only one city state and zip code.  However, when I type that code into the USPS web site, I get seven different cities.

<?xml version="1.0" encoding="UTF-8"?>
<CityStateLookupResponse><ZipCode ID="1"><Zip5>65202</Zip5><City>COLUMBIA</City><State>MO</State></ZipCode></CityStateLookupResponse>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Awarded 2010
Top Expert 2013
Commented:
You are not missing anything. The USPS has a single default city that is the official city for that zip code based on how mail is routed. The API only returns that city.

The other city names are part of a different database. I can't find an API call for those (and I doubt it exists because they don't want you to use them).
Awarded 2010
Top Expert 2013

Commented:
Note that this is not a question of "primary" vs "other" cities. This is a question of the "correct official" city name associated with a zip code vs. local municipality name.

If you are using this to find what city to mail something to, then you want the city they are giving you. You don't want the other cities anyway.

Author

Commented:
Thanks Tommy.  It answers my question - I was hoping to get a list of cities (I'm developing an e-commerce web site that prompts the user for a ZIP code to help fill in their address).  Do you know of any other API's that I can recommend?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial