Read the labs blog
SunlightLabs API
states.getNameFromAbbreviation
Get the state's full name from its two-letter abbreviation
Arguments
These are all $_GET parameters.
state (required)
The state's two-letter 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/states.getNameFromAbbreviation.php?state=MD &apikey=23kj234kjb3kjbcl87ds
says give me the name of the state with abbreviation "MD"
Example Response
For the default JSON:
{ "state_full_name": "Maryland", "state_abbreviation": "MD" }
For XML:
<results> <state_full_name>Maryland</state_full_name> <state_abbreviation>MD</state_abbreviation> </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
203: invalid state
The state abbreviation was not valid

