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

    Choose the API you want access to, then fill out the request a key section (see on the right here).

    0_1500147317624_Screenshot 2017-07-15 15.34.29.png

    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:

    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:

    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! 0_1500147117959_Screenshot 2017-07-15 15.29.32.png

Log in to reply