Sunlight Labs API Transition Guide
Those familiar with the old Sunlight Labs API may look at the new API and wonder if the drastically reduced method count means reduced functionality. The new API only disposes of a few rarely used methods, and in fact introduces new functionality and flexibility that we think will make the new API more useful to practically all users.
If you are new to the Sunlight Labs API we also recommend that you sign up for the API discussion list to communicate with other users and receive email alerts of the latest updates.
In addition, the data in the old API will no longer be actively maintained, whereas the new API has an automated update mechanism that ensures that the latest members of congress are available typically within a week of their election, often earlier.
Because we encourage all users of the old API to update to the new API, we have provided this transition guide that explains how old methods map to new methods, and in the case where we did have to remove some functionality, where we recommend you go for similar data.
people methods
- people.convertId - use legislators.get which returns all ids, and grab the id(s) that you need
- people.getDataItem - use legislators.get which returns all data, grab the data item(s) you need
- people.getDataCondition - use legislators.getList which returns all data on all legislators which match the condition, as opposed to just their id
- people.getPersonInfo - use legislators.get
- people.getHCard - no replacement in new API
- people.reps.getRepFromDistrict - use legislators.get?state=XX&district=YY
- people.sens.getSensFromState - use legislators.get?state=XX&title=Sen
| Old API | New API |
|---|---|
| state_full_name | removed, use state |
| member110congress | use current_member |
| senator_class | removed |
| photo | see photos |
| state_abbreviation | state |
| URL | website |
| CRPcandId | crp_id |
| WashPost_ID | bioguide_id |
| BioGuide_ID | bioguide_id |
| VoteSmart_ID | votesmart_id |
| FEC_ID | fec_id |
| congresspedia | congresspedia_url |
| Eventful_ID | eventful_id |
| GovTrack_ID | govtrack_id |
| entity_id | sunlight_old_id |
state methods
Both state related methods (states.getAbbreviationFromName and states.getNameFromAbbreviation) were infrequently used and unnecessary. It is not wise to use a webservice to do this conversion as it is trivial to obtain a table of this data and store it within the application without the repeated overhead of making an HTTP request.
places methods
A fair number of methods were removed from the places-related methods, but everything related to districts has been preserved as these were the only methods that saw any real usage and for which we are reasonably confident about the sources of our data.- places.getCityStateFromZip - removed
- places.getDistrictFromAddress - use google/yahoo/geocoder.us to get lat/long and then call districts.getDistrictFromLatLong
- places.getDistrictsFromZip - districts.