Campaign: Using Data

Problem with List of State Codes and Zip Code Search

I'm trying to retrieve the population for a certain zip code.

 

What I found in your online documentation is that I should use the following URL string:

 

http://api.census.gov/data/2010/sf1?key=(key)&get=P0010001&for=zip+code+tabulation+area:(zip)&in=state:(state)

 

...where (key) is my API key, (zip) is the zip code, and (state) is a two digit code that you use to identify states.

 

The problem that I run into is that I cannot find a correct list of states and their corresponding two digit codes. What is particularly frustrating is that you have a list posted at the following address which seems like it provides the two digit codes for states. However the two digit codes on the list at this link do not match up to the data output by the above API URL.

 

http://www.census.gov/govs/www/gidstate.html

 

What gives? Is the API not working properly for this type of search? If it is working properly then where can I find the REAL state code list?

 

Also, why won't the API return a query like the following, where I could just search by zip code for all states?

http://api.census.gov/data/2010/sf1?key=(key)&get=P0010001&for=zip+code+tabulation+area:(zip)&in=state:*

Thanks

Submitted by

Tags

Voting

1 vote
1 up votes
0 down votes
Active
Idea No. 186