6 Really Cool APIs to Have Fun With

January 1, 2020

Some of the most fun I've had with Javascript has involved combining publicly available APIs in interesting ways.

The instant gratification of APIs got me hooked on hobby projects and helped me learn Javascript without even realizing it. If you have an itch to make something or expand your knowledge but don't know what to build, experimenting with APIs is a great place to start.

Here are some of the publically accessible APIs that I've played with for inspiration.

1. Lob API

What is Lob?

Lob is snail mail as a service. Lob enables postcards, letters, invoices, and checks to be sent programmatically.

I live in a tiny apartment and refuse to get a printer because they take up a lot of space. I only need to print like 5 documents a year. So I started using Lob as a proxy for printing. I issue a POST request to lob's /letters endpoint with a url to your document, and I get a printout in the mail a few days later.

I think there's a lot of fun to be had with APIs that provide a physical service.

Lob can print and ship PDF and html documents and is pretty cheap (pricing starts around $1 + 10 cents a page).

2. Scale API 

Scale is kind of like a Amazon Mechanical Turk with a smooth API reminiscent of Stripe.

Those tasks that can't be automated you can break down into units and delegate to Scale's mercenary workforce. Need a human to scan a comment and tell you whether it's spam? With Scale it's just a matter of issuing a post request with the task details and deadline. There is something very appealing about an API for human intelligence tasks.

To use Scale's API you need to be pretty granular about the task. For example, I used Scale to handle exceptions when scrapings Amazon product pages. When the scraper couldn't find the information it was looking for, my application would create a new Scale task asking a laborer to look at the product page and check to see if the information was presented differently.

Some human intelligence tasks can't easily be broken into discrete units. Such tasks aren't well-suited to Scale. Also, Scale isn't cheap and tasks are obviously not completed instantaneously. When you create a task you provide a webhook URL that gets pinged when the task is done.

3. Gmail API

Gmail's API was a bitch to work with. It has lots of quirks and authorization via service accounts vs tokens was poorly documented. However, once you're up and running it was a blast to use Gmail's API.

I wanted to use the Gmail api to programmatically filter all messages that aren't from actual people. At the time I had 5000+ unread messages. It was just too painful to sift through them. So I made a more aggressive version of what Gmail already does with the Promotions tab.

4. Google's Unofficial Autosuggest API

Google has slowly sunsetted programmatic access to their search results pages. The Google search API is slowly being phased out and was prohibitively expensive to begin with.

You know when you starting typing a query Google lists some best guesses about what you're after in the search input field? You can unofficially fetch these suggestions.

My use case was hunting for available exact match domain names based on some seed keyword. So if you were interested in antique cars, you'd start with that keyword, fetch the suggestions from Google's undocumented autosuggest API and then run each suggestion against a domain registrar for availability.

5. Skyscanner API

Google Flights API shutdown recently with little advanced warning.

It's surprisingly difficult to find reliable flight information if you don't have deep pockets and aren't a big brand.

Skyscanner's API is one of the few remaining ways for the hobbyist to gain access to flight information.

6. Chromeless With AWS Lambda

The folks behind Graph.Cool developed Chromeless to solve the problem of headless browsing encapsulated by a lambda function.

Maybe you've heard of Nightmare.js?

Nightmare is a wrapper around electron with a nice, chainable API that lets you programmatically do things in a browser window. Some of nightmare's use-cases are application testing, screenshotting, scraping, etc. It's trivially easy to navigate to an arbitrary web page with nightmare and take a screenshot.

Running nightmare locally is straightforward but it's a pain to run on AWS, Digital Ocean, etc. It would be much cleaner to run nightmare in lambda than a customized EC2 instance or Digital Ocean droplet. The problem is nightmare's dependency on electron which results in a massize bundle size.

Chromeless solves this problem by duplicating nightmare's slick API but instead depends on chromium instead of electron.

The crazy thing is that you don't even need to run a specific sequence of commands in a lambda function.

Chromeless enables you to deploy a remote client that will execute any command you send it. On your local machine or web server you establish a WebSocket connection with your remote lambda client and start issuing commands. Behind the scenes theses commands are sent to your Chromeless remote as JSON.

6. Twilio

Twilio belongs on this list because there are all sorts of cool things you can do by interfacing with SMS. I started experimenting with Twilio to send myself SMS reminders.