Return to Blog

Factual API Feeds Applications, Hungry Seafood Lovers

At Factual, we are all about the data, but we also get that data isn’t always best represented in a table or grid – and that sometimes a chart can immediately sum up gobs of underlying facts. We also know that we can’t build every way (or even all that many ways) to interact with our data. One of my jobs at Factual is to figure out how to open our data to all the developers out there, and with their help, I hope that Factual will become a compelling alternative to closed, self-hosted silos of data. Our beta launched with version 1 of our API (see, and while we are seeing some nifty uses, we haven’t stopped to rest – version 2 is a huge, glossy leap forward…more on this later. Today, I want to show you some of the things you can do with the Factual API, err…TODAY.

Factual has lots of good vegan/vegetarian data, so I thought I’d cover a little ground for those of us with slightly more carnivorous leanings. I’m not a big red meat eater, and one can only eat so much chicken, so for the most part, that leaves seafood (sorry pork-o-philes, I only like ribs and bacon – not exactly staple options). One day, at a fish market, my wife reached into her bottomless purse and produced a small, folded pamphlet that enumerates various seafood and their respective mercury levels. This got me thinking, “what if I’m faced with a tantalizing fish special? Surely, a bunch of computers can replace this tiny pamphlet.” Seriously, though, there was public data on mercury levels but it wasn’t interactive, or (shameless plug for us) joinable with other relevant information, such as sustainability, deliciousness, cost, etc. In short, I uploaded the data to Factual and now, it serves as a bite-sized data set for some API examples.

For the first example, we’ll crack open our first Easter Egg. The Factual API supports output in Google Visualization datasource format. This means that you can point lots of Google visualizations and other gadgets at a Factual URL and voila, your piles of money chart is ready to serve. It takes very little code to make a clear point: No swordfish or shark for you. Oh, and definitely pass on the tilefish dujour.

And now, a little something for the calculated risk-takers out there. I threw this together a little while ago, not just so my coworkers could tease me, but to show a pure JavaScript implementation using a JSONP callback. I’m no artiste, so it’s a poor homage to the original masterpiece, but it’s a little app that mashes up Yahoo image search with Factual data to produce a silly app to answer the all important “what fish should I eat today?” question. Under the hood, it grabs all the fish species names and mercury levels from this Factual table, then grabs the first matching picture it can find on Yahoo. It then rigs the odds to land most often on seafood with the lowest levels of mercury. The slot machine effect is just for show since you’re always a winner (unless you land on tilapia or mullet – keep spinning and you’ll see).

I hope this tidbit gives you some new ideas about the Factual API. We’re working every day to make it more powerful and more accessible, and we hope you follow our progress as we roll out new and better ways to bring data to your projects.

– Boris Shimanovsky, Engineer at Factual