Propublica APIs ... and how to query an API
I’m using Propublica data for a side project at the moment. Their most prominent api data is their congressional data, which used by a few big data heavy news sites (like Five Thirty Eight).
This post is about how you would go about getting an API key and querying a public api.
First, hit https://www.propublica.org/datastore/apis
Choose the API you want access to, then fill out the request a key section (see on the right here).
In order to get access to their free apis, you need to request a key. They got back to me fairly quickly, and the structure of their REST apis is nice and clean.
To make the calls, first figure out which endpoint you want to hit. For the congressional api, here’s a list of endpoints: https://projects.propublica.org/api-docs/congress-api/endpoints/
To be able to make the call in a browser and get the data back in a nice clean format, I use a free chrome extension called Postman; you can download it here: https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
I open it up with the apps icon in chrome, then paste the url that I want, for instance, lets say you wanted to see the cosponsors on bill B001260 (you’d know the number from a different query)
And then tap on headers add the key they issued me there by putting this is the key box: X-API-Key and this your api key issued by them int hte value box.
Voila (screenshot below). Nice clean JSON object, easily readable… No spin, just the exact data you queried for!