Read the labs blog
SunlightLabs API
people.convertId
Convert between one ID and another, e.g. given an input VoteSmart ID, return the equivalent GovTrack ID
These are the different ID types available:
| Name | Description |
|---|---|
| entity_id | The common ID being promoted by the SunlightLabs |
| CRPcandID | The Center For Responsive Politics' candidate ID |
| WashPost_ID | Washington Post's ID for this person |
| VoteSmart_ID | Project Vote Smart's Id for this person |
| FEC_ID | Federal Electoral Commission's ID for this person |
| BioGuide_ID | BioGuide's ID for this person |
| Eventful_ID | Eventful's ID for this person |
Arguments
These are all $_GET parameters.
id (required)
An ID of any of the types above. (This is the actual ID not its type.)
fromcode (required)
one of the codes above specifiying what type of input ID this is
tocode (required)
one of the codes above specifiying what type of output ID is desired
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/people.convertId.php?id=N00004643&fromcode=CRPcandID& tocode=GovTrack_ID&apikey=23kj234kjb3kjbcl87ds
says take the ID "N00004643" which is of type "CRPcandID" and convert it to a "GovTrack_ID".
Example Response
The output is a JSON string with the original ID and the result ID:
{ "CRPcandID": "N00004643", "GovTrack_ID": "300005"}
For XML:
<results> <CRPcandID>N00004643</CRPcandID> <GovTrack_ID>300005</GovTrack_ID> </results>
Error Codes
If there is an error: a plain text string will be returned:
0: no data
No data found for that entity for that output type
1: entity not found
This could be because the ID is not of type 'fromcode' or it may be that that person is not in the 110th Congress
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
200: invalid input code
Unrecognized fromcode
300: invalid output code
Unrecognized tocode

