August 8, 2011

As more and more journalists are finding, APIs are a great way to get data for your Web applications and projects.

An API, or application programming interface, enables software programs to communicate with one another. (Chrys Wu wrote a helpful intro here.) To give you a better understanding of how they can help you, I’ve outlined some of the best APIs for finding content and explained how you can use open-source programming tools to glean information from them.

Twitter API

Twitter’s API is very well documented and has a lot of useful functionality. It’s especially useful for journalists who want to search Twitter for a term and either show or parse the results. Let’s take a look at how we can easily do that.

Here is some simple example code that searches Twitter for the term “earthquake” and then creates a bulleted list for the tweets that are found. You can copy and paste the code and replace the word “earthquake” with whatever term you want to search for.

If your development team uses open-source tools, there are some great libraries for parsing the Twitter API with much more advanced functionality than the snippet above. For PHP, use TwitterOAuth. For Python, use Tweepy. For Ruby, use Grackle.

Google Maps API

Google Maps has an extensive API with many different features. You can use it to build maps, geolocate tweets (or other pieces of data with latitude and longitude variables), search for local schools, or even measure elevation or distance. The API has a lot of documentation with several examples. Depending on what you’re trying to do, you can find code snippets to help you achieve your goal.

Here are a few good examples from the documentation:

There are also numerous wrappers for the Google Maps API in PHP, Python and Ruby, so consider reaching out to your development team for advice on how to integrate Google Maps with the apps they’re already building.

Facebook API

The Facebook Graph API is JSON-enabled and has search functionality similar to Twitter. You can search for who is posting publicly about topics, search Facebook Places, and see photos and videos posted publicly or by your page’s followers.

Facebook has a fairly extensive section of code examples that you can use and tweak to your liking. Some highlights are:

Other noteworthy APIs

The folks at Participatory Politics and Sunlight Labs have built a series of amazing APIs with access to government data — a notoriously tricky task. They have a new project called Open Government that aims to help users track numerous government data sets pertaining to politicians, bills, campaign donations and voting — all the way down to the local level.

Although they don’t have support for every state yet, Open Government is under active development, so more states will be added over time. The code they’re using is all open-source and built in Ruby.

Developers at the Chicago Tribune and The New York Times regularly blog and share their own APIs. Check out what projects they’re working on, and build and release your own.

Experimenting with APIs is just one of many ways to build your skills as a digital journalist. The more you know about the open-source culture, the more you can effectively share data, collaborate with others in the newsroom and, perhaps most importantly, tell innovative stories.

This story is part of a new Poynter Hacks/Hackers series. Each week, we’ll feature a How To focused on what journalists can learn from new tech tools and emerging trends in technology.

Support high-integrity, independent journalism that serves democracy. Make a gift to Poynter today. The Poynter Institute is a nonpartisan, nonprofit organization, and your gift helps us make good journalism better.
Donate
Katharine Jarmul is lead developer at Loud3r, a content-curation start-up based in Los Angeles, California. She spent four years at the Washington Post and USA…
Katharine Jarmul

More News

Back to News

Comments

Comments are closed.