Read the labs blog
SunlightLabs API
places.getZipsFromCityState
Get the zipcode(s) from a city and state
Arguments
These are all $_GET parameters.
city (required)
The city's full name
state (requried)
The two-letter state abbreviation
apikey (required)
your individual API key
metadata (optional)
&metadata=true provides detail about source, last update of the information etc. Click here for details
output (optional)
&output=json is set by default. You can also use &output=xml
Example Call
http://api.sunlightlabs.com/places.getZipsFromCityState.php? city=College%20Park&state=MD&apikey=23kj234kjb3kjbcl87ds
says give me the zipcode(s) for College Park, MD
Example Response
For the default JSON:
{ "city": "College Park", "state": "MD", "zips": [ "20740", "20741", "20742" ] }
For XML:
<results>
<city>College Park</city>
<state>MD</state>
<zips>
<zip>20740</zip>
<zip>20741</zip>
<zip>20742</zip>
</zips>
</results>
Error Codes
If there is an error: a plain text string will be returned:
100: invalid API key
The API key was invalid
101: API key not valid for this method
Not permitted to call this particular method with this particular API key
202: invalid combined user input data
The city+state was not valid

