About APIs...


API means Application Programming Interface -- but for us in this course it means another way of accessing a lot of great data sources.

If you Google it, you'll see that many applications on the internet provide API connections.

  • Twitter
  • Youtube
  • Spotify
  • Gmail
  • Google Analytics

...and many, many more online services.

You can use an API to connect to the database of an online service and download part of their raw data via coding. You can use many languages for that, but in this course we'll do that via Python. Well, I have to add that you can do many, many more things with these APIs -- but for now, let's focus on the data science aspect: getting new datasets.

In this module, I created tutorial videos on four different APIs.

I'll show you how you can query datasets of real projects by using:

  • the Coinbase API -- so you will be able to analyze crypto-currency trends
  • the OpenWeather API -- so you will be able to analyze weather data
  • the YahooFinance API -- so you will be able to analyze stock trends
  • and the Twitter API -- so you will be able to analyze social media interactions.

Have you ever seen someone create data science projects where they correlated a famous person's tweet sentiments with stock price movements… Well, there are good chances that they got the data for that analysis via APIs.

Obviously these are just four APIs. There are many more -- and once you get a good grasp on how APIs work -- hopefully by the end of this module -- a whole new world will open up for you, and you'll be able to get access to many other applications' databases... And well, hopefully build something more meaningful than a twitter-sentiment-vs-stock-price correlation.

So I'll show you video tutorials for these four, but of course, next to the tutorials, you'll also find the Jupyter Notebooks that you see in my tutorials, so you can easily re-run my code.

Before we get started, let's talk about the single biggest issue of APIs.

For that let me show you the documentation for the Coinbase API, for instance. Does it look nice and easy? No! It looks super complicated…

Here's the thing: APIs are built by developers for developers, so they are usually well-documented but not very user-friendly. This looks scary, I admit it -- but in fact, all you have to do is to stay patient, read through the whole documentation and find those few lines that you'll need for your projects. Yes, it can take an hour or more but once you read everything and find what you need, it'll all become very simple.

If you don't want to go through all lectures in this module, I still really, really recommend that you start with the Coinbase API example. You'll see that -- while this documentation is just way too much to take in at first sight -- eventually it'll take no more than six short lines of Python code to get the actual raw data we need.

Hopefully the Coinbase example will demystify this whole API thing for you -- and once you get that, you'll feel much more comfortable with all other APIs on the internet.

Here, I have to add that in essence all APIs are the same… but they are all different, too. Why? Because the idea is the same behind all of them -- but they are built by different people… so the implementations will come with a few small but important differences.

I selected the four specific APIs to present in this module for a reason.

With these four examples you'll see the most common API challenges:

  1. The Coinbase API will be the simplest example of querying raw data. As I said, I start with this because it'll demystify the whole concept and it'll show you that APIs are, in fact, not that difficult to use -- once you get them.
  2. The OpenWeather API will demonstrate another important aspect: in that lecture we'll add an authentication layer, as well.
  3. For the YahooFinance API, we'll go one step further, because there, we'll need to install a new Python library, too.
  4. And to use the Twitter API, you'll have to try out another, even more advanced type of authentication method.

As you can see, we will start with the easiest and will move towards the hardest solutions. And I really, really recommend that -- even if you are not interested in all four of these APIs -- you go through them regardless, for the sake of learning.

And again, you'd be surprised how many of the services you use offer API connections and a way to extract data out of them by coding. So after finishing this module, take a list of your favorite online services, and then type their name plus the word "API" to Google. As I said, a whole new world of data will open up for you.

Okay, so to finish this video here are a few final thoughts:

  • Remember, APIs are useful, they are great data sources for your projects.
  • They look difficult at first sight, but you don't have to get intimidated!
  • You should be patient, read through the documentation and find the few lines of code you'll need for your project. (For me it usually takes an hour or even more to figure out how a new API works, and that's totally fine!)
  • And go through all the lectures I show in this module -- try out all these APIs -- and then start with a few small examples and scale from there.

Okay, it's time to go deeper!

Complete and Continue