Choosing an API

George Kirby
Dec 8, 2019 · 4 min read

APIs (Application Programming Interfaces) are a crucial part of programming. An API is a way (an interface) for one app to allow others to interact with it, without having to provide direct access. It can receive a request and provide a response, often in JSON.

I’ve recently been getting to grips with a couple of APIs that I’m using in a small personal project. I found them through RapidAPI. This site has thousands of APIs, many of which have a good freemium model — something which is vital for a personal side project. In this article I’ll outline a few things to consider when choosing an API for your own projects:

1. Skim the API’s “vital statistics”

RapidAPI displays a handy snapshot of each API’s popularity, average latency over the past month, and average return rate over the past month.

The Free NBA API has a better average latency than Cricket Live Scores, but a much worse return rate.

This gives you a quick way to judge if the API is right for you. A low return rate is particularly off-putting: imagine writing a great app that only works 43% of the time because the API it calls fails to return anything useful!

Much better!

2. Check pricing plan

So you’ve found a promising API. But is it affordable? Select the API you like the look of, then go to the Pricing tab:

This shows the API’s various pricing plans, which usually starts with a free version.

A couple of things to consider:

  • What happens if you exceed the quota?

On the above API’s free plan, every request over the 100/day quota will cost you $0.005. Pretty cheap, but it means you have to be extra-careful in your code. Imagine getting stuck in an infinite loop making calls to an API! Infinity x $0.005 is a lot of money :O

Alternatively, the plan may have a hard limit on the number of requests in a certain time period, so if you reach that limit you can’t make any more requests until the time period resets. This means you don’t have to worry about being charged, but it could restrict you while testing your app. You might prefer to be charged a little bit and still be able to make requests.

  • Information may vary

It’s worth looking on the API’s own site to see if it matches what’s displayed on RapidAPI. For example, I’m using a weather API called Dark Sky. The pricing page on RapidAPI states a quota of 100 requests per month — very restrictive!

Thankfully, the API’s own site reveals the quota to be a much more useful 1,000 requests per day! (Also, each extra request is ten times cheaper!)

https://darksky.net/dev/docs

3. Digging deeper

The next step is to investigate and see if the API gives you the information you actually want, in an accessible way. On the Endpoints tab, you can see what the API response looks like for a few example requests.

That’s a lot of endpoints!

On some APIs you can do a custom test by changing the Required Parameters and clicking the blue Test Endpoint button, but many require you to sign up for a plan first.

Finally, check the documentation. It’s important to be able to understand the ins and outs of the API, especially for making for complex requests. One of the reasons I’m using Dark Sky is because of its comprehensive docs. API Football is another good example:

Next steps

Having chosen an affordable API that suits your needs, you can now get on to the real fun — developing! :)

I hope you found this article useful. Let me know your own tips and sites for choosing an API!

George Kirby

Written by

Software Engineering graduate, now looking for my first role! :) linkedin.com/in/georgeskirby, github.com/george-kirby

More From Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade