Power BI Mini Master Class 1: Using a REST API as a data source

Extract data from the API: Your first API call

This is a preview lesson

Register or sign in to take this lesson.

The tutorial continues with retrieving country IDs from the UN Data API to get population forecasts.

Files for this lesson:

Download all course files here. (You need to login to see the files)

In this lesson you will use:

  • Sources.txt
  • UN Data.pbix

About this lesson:

Here’s a summary of the video content:

  1. Overview:
    • The tutorial continues with retrieving country IDs from the UN Data API to get population forecasts.
  2. Getting Country IDs:
    • The API URL for locations is population.un.org/api/locations.
    • This URL retrieves location IDs for all countries, which will later be filtered for specific regions (e.g., European Union).
  3. Using Power BI:
    • The tutorial uses Power BI to perform a web query with the provided URL.
    • Power BI fetches data in JSON format, converting it into a table and expanding the data.
  4. Handling Pagination:
    • The API returns data in pages, with the first page containing 100 records.
    • To retrieve all records, the tutorial demonstrates how to handle pagination by appending a page number parameter to the URL.
  5. Creating a List of Pages:
    • The tutorial shows how to create a list in Power BI to iterate through all available pages.
    • A dynamic list is created based on the total number of pages.
  6. Custom Columns for Page Numbers:
    • A custom column is created in Power BI to modify the URL for each page number.
    • The tutorial details converting numbers to text format for URL compatibility.
  7. Combining Data:
    • Data from all pages is combined into a single table.
    • The tutorial filters out unnecessary columns, keeping only the IDs and names of the countries.
  8. Next Steps:
    • The next module will involve retrieving a list of European Union countries through web scraping.
    • The final objective is to filter the location data to focus on these countries.

The tutorial provides a step-by-step guide on accessing and handling paginated API data using Power BI, with a focus on UN population data.

Was this helpful?