The CARMA API provides REST-based access to data available on the CARMA site.
Use of the API does not require an API key, although CGD/CARMA reserves the right to limit or terminate access to the API at any time. If you make use of the API, we ask that you be polite and limit how often you make a direct call to the server and cache the result of API calls locally.
API calls either return a JSON or XML string or an error message (Ex: Error: no matching plants.) This data can then be easily parsed and used to create widgets and/or mashups. PHP5 comes with the built-in function, json_decode, which converts JSON into an array.
Congressmen exist in the database as locations, because they represent a certain congressional district (location).
Let's start off by doing a search for James Moran using the searchLocations method.
This is a 2-step process. We first find the company ID from the searchCompanies method.
When searching for the company Dupont, we will recieve a string of result data in JSON format.
Looking closely for the ID, and 5012 appears. Now use that ID in the searchPlants method.
or to narrow by region_type (3=state):
Looking at the JSON from example #4, Idaho has the location ID of 1211. Plug this into searchPlants and voila!
Argentina's location ID is 15. Use that ID for the next call, also setting color=blue
CARMA is about equipping people with the best information. So if you've got a question, find an error, or just want to give us your reaction, we want to hear it.