How to Use Postman to Make Life with External APIs Way Easier

Over the last two weeks, I’ve been developing a government accountability app based on several public data sources. The primary source is the Sunlight Foundation’s Congress API, but we’ve supplemented this with data from NYT, and LittleSis.

Hosting data on your own server can be ideal when you can get the full data set, but external API calls come in especially handy during rapid prototyping. You can quickly mash up information from multiple sources and see what interesting details emerge.

During this project, I ran across an app called Postman, an HTTP client that reduces a variety of pain points that show up when exploring a new API. These pain points include:

  • Crafting queries and testing optional parameters
  • Formatting and evaluating objects returned
  • Keeping track of successful queries and all the parameter options you’ve tried

I’d like to show you how postman tackles these.

Using Postman is easy as plugging in an API call and hitting send. The clearest feature up front is the clean formatting of the response object. Rather than parsing through a glob of JSON, you can quickly scan a tabbed and lined object to find the data you need.

Postman main screen

If you want to adjust your query, Postman offers a “URL parameters” button where you can list out every parameter you want to include without hunting through ?s and &s.

Postman URL parameters

Once you discover queries that do what you want, you can save them and organize them into collections. This is extremely helpful when sorting API calls for each project and then easily finding calls to use later in new projects. I love this feature as I usually run across something that would make a great one-page visualizaton, but doesn’t quite fit my current purpose.

Postman History

If you forget to save a call or your browser crashes, Postman has you covered with a simple History tab that lists all your recent activity.

As if all this wasn’t enough, Postman also lets you set up and manage environments based on your projects. Just load in keys and values as they appear in your code and you can test your API calls as they’ll show up in the environment you’re working in. No need to rewrite or translate just for testing.

Postman Manage Environments

 

All in all, Postman is a must have for you tool kit when developing apps that make external API calls.

Introducing Tilden: Exploring money and influence at the federal level

Over the course of two weeks, I’ve been working alongside a team at Hack Reactor to build a political accountability app based on public data sources.

The seed project was crafted by Greg Hilkert who used the Sunlight Foundation’s Congress and Influence APIs to visualize corporate donations to U.S. Senators and Representatives. He actually got a chance to describe it to TechCrunchTV (around the 6-minute mark).

While Sunlight provided our primary data set, we supplemented our information with APIs from the New York Times and LittleSis. I was primarily interested in LittleSis data as it crowdsources who-knows-who relationships from citizen analysts. For many politicians you can see who they went to college with, what boards they serve on, societies they’re a member of, and who their human donors are.

Profile of U.S. Representative.

A brief rundown of our tech stack includes Angular, d3, node.js, ActionHero.js. We incorporated Travis CI for testing to keep track of pushes that broke the code. The team also chose to write the app in CoffeeScript, which I have to admit made the code nice and tidy.

For just two weeks, we got some great stuff done. Visitors can find their reps via a dynamic map that zooms into districts based on geolocation or address. Each rep’s profile pulls together biography and contact data, as well as information about donors and committees they serve on. If you want to compare two reps, you can put their biggest corporate donors side by side for comparison. Finally, one of our team members built a really interesting module that evaluates word frequency per rep on the congressional record.

Tilden district map

Working with multiple APIs and making decisions about what data to host ourselves and what to send external requests for was a good problem to tackle. Every election season brings up new political data apps, but I ran across data that would be really interesting to zoom in on during off years.

Blog Updates: Pulling together posts from elsewhere

If you notice a lot of posts suddenly appear in your RSS, I’m pulling together writing and thoughts from the past couple years to keep everything in one place.

I’m not using newsplay to solely talk about the intersection of games and news anymore (though that’s still an interesting subject). Instead, I’m expanding the scope to what I find in daily coding and work life in SF. I’ll keep talking about where code applies to news, but there will be more variety from here on out as I make this my primary blog.

Short post on Hack/Hackers from ONA last year

ONA 2012Dropped in on ONA this year with fellow Cronkite alum Evan Wyloge. One of the most interesting keywords that kept popping up was “Javascript.”

At the hackathon, a number of trained journalist were gushing about adventures in Javascript and love for packages like Ember. Without the need for a compiler, Javascript’s immediate visibility in the browser seems an ideal fit for journos playing with data and visualization.

From another direction, Javascript came up in conversations with friends who hit the ONA job fair. Solid reporters were saying that multiple publications were asking candidates about Javascript knowhow, sometimes saying that’s all they were hiring for this time around. It’s clear that storytelling is increasingly happening through code, but fascinating to see evidence in turning away reporters who don’t include coding in their skill set.

JTech Weekly and RemakeCamp

Today, I get a full five minutes to share at RemakeCamp about lessons I’ve learned from working on Mediactive.com. I plan on talking about principles for selecting good tools for citizen journalists. People at this thing are way smarter than me, so I’ll probably learn more than I share.

JTech Weekly LogoIn other news, I’ve started a journalism tech podcast with @chcameron. It’s appropriately named JTech Weekly. Well, it hasn’t been entirely weekly, so the name is somewhat appropriate now, but will achieve full appropriateness as we meet our goal of weekliness. If you get a chance, give a listen and give feedback at the cast’s site. It’s brand new, so the more critique, the better.