API - What, Where, When, Why?

by Joe Macari

This week for our project we were to design an app in Alteryx which drew its data from an API – or in non-abbreviation speak, an Application Programming Interface.

Previously APIs were things of myth, fable and legend to me so I thought I would introduce them to you in my own little way.

 

What?

An API is an access point to a database via a webpage (or URL). The way that you write the URL is dependent on what table of the database you access, these are known as endpoints.

 

Where?

We have already learned that they are accessed online but there actual location is most likely on a server in some far off distant location. Perhaps even stored on the cloud and so based in one of the massive data centres that exist. Some of them are completely free to access (go open data!), some you can get a trial for and others you pay for access.

 

When?

You can access APIs at anytime, anywhere (as long as you are online). However, you will only be able to draw data (call data) from the API so many times per second/day/month. This is dependent on the T&Cs of the API you are using. This is something to keep an eye out for as if you have a low call rate you will most likely burn out your access fairly quickly, especially if you need to do a lot of debugging.

 

Why?

APIs are incredibly useful as they are online and therefore don’t take up storage space on your PC. If you find a good one they will be updated regularly (very good for sports). If you host an API you are able to give access to a high number of people for not a lot more effort as a standard database, and those that access it need to be fairly skilled.

 

Challenges with APIs

Finding one that works for you. They are not always the easiest thing to access – I am not sure if they do this on purpose but you do have to dig around a bit to sign up for an API key (this lets you access the API).

If the API is not well documented you may struggle to navigate your way around it.

You will need some software which can read the coding language that the API is stored in. The API I used you could either get the data in XML or JSON format – Alteryx is very good for this.

 

What we used

This week I worked with the SportsRadar API and I created a NFL players info dashboard (I ran out of time for any decent visualisation). The great thing about this API is that there is really good documentation about what is contained and how to access the different tables. Also, they seem to update it daily – absolute gold!

Below are some of the other APIs that we used in DataSchool this week:

George looked at beers: http://www.brewerydb.com/

Jeremy looked at Wikipedia: https://www.mediawiki.org/wiki/API:Main_page

David looked at clinical trials in the US: https://clinicaltrials.gov/ct2/about-site/link-to

Eliott looked at stock market indicies: https://www.coindesk.com/api/ and https://www.quandl.com/

Charlie looked at US food comparison data: https://ndb.nal.usda.gov/ndb/nutrients/index

Michael looked at Spotify (not for the faint of heart): https://developer.spotify.com/web-api/

Giorgia looked at food facts: https://world.openfoodfacts.org/data

Steph used the Giphy API to provide hints for crosswords : https://developers.giphy.com/

 

If you have any questions, queries or would like to share your experience using APIs please let a comment below or on my twitter page @DriveMyData.