In this lesson, we'll learn to query basic APIs to retrieve data about the International Space Station (ISS). Using an API will save us time and effort, and being able to use APIs to access web data is a common skill required of both data analysts and data scientists.

An API is a set of methods and tools that allows different applications to interact with each other. Programmers use APIs to query and retrieve data dynamically (which they can then integrate with their own apps). A client can retrieve information quickly and effectively through an API.

Although working with data sets - which you’ve spent a lot of time doing so far in our data science courses - is great, there are some circumstances in which working from a pre-created data set isn’t efficient, such as when:

  •  The data change frequently. It doesn't really make sense to regenerate a data set of stock prices, for example, and download it every minute. This approach would require a lot of bandwidth, and be very slow.
  • You only want a small piece of a much larger data set. Reddit comments are one example. If you wanted to pull just your own comments from Reddit, it doesn't make much sense to download the entire Reddit database and then try to filter it for a few items.
  • Your work involves repeated computation. For example, Spotify has an API that can tell you the genre of a piece of music. You could theoretically create your own classifier and use it to categorize music, but you'll never have as much data as Spotify does.

In cases like these, an application program interface (API) is the right solution.

As you work through each concept in this lesson, you’ll get to apply what you’ve learned from within your browser so that there's no need to use your own machine to do the exercises. The Python environment inside of this course includes answer checking so you can ensure that you've fully mastered each concept before learning the next concept.


  • Learn the advantages of APIs
  • Learn how to create and process API requests
  • Learn about the JSON data format

Lesson Outline

1. What's an API?
2. Introduction to API Requests
3. Types of Requests
4. Understanding Status Codes
5. Hitting the Right Endpoint
6. Adding Query Parameters
7. JSON Format
8. Getting JSON From a Request
9. Content Type
10. Finding the Number of People in Space
11. Takeaways