Search API Connector Documentation

Print

Import Udemy Data to Google Sheets

In this guide, we’ll walk through how to pull course data from the Udemy API directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get some credentials from Udemy, and then set up a request to pull in data to your spreadsheet.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Udemy API Credentials

  1. Log in to your Udemy account and click your account icon in the top right, then API Clients from the left sidebar (or click https://www.udemy.com/user/edit-api-clients/ to go there directly).
    udemy-img1
  2. Click Request Affiliate API Client
    udemy-img2
  3. You’ll be asked to provide some information about how you’ll use their API data. Fill it out with the relevant details and click Save.
    udemy-img3
  4. You will need to wait a day or so to be approved. Once you receive your approval email, click back into the API Client section, and you should now see your authentication details. Pay attention to the client ID and secret as we’ll need those next.
    udemy-img4

Part 2: Create Your API Request

Udemy requires that we encode our client ID and secret using Basic Auth. To speed things up a little, let’s import a cURL snippet. This will set up the whole request in one go, and take care of encoding your credentials for you.

  1. Copy the following snippet to your clipboard
    curl --user YOUR_CLIENT_ID:YOUR_CLIENT_SECRET https://www.udemy.com/api-2.0/courses/?page_size=100&category=Music&ordering=most-reviewed
  2. Click Add-ons > API Connector > Import / Export > Import cURL and paste in that snippet. It should look like this. Don’t hit import just yet.
    udemy-img5
  3. Now substitute in your client ID and client secret (leave the colon separator between them). Click Import and you’ll see the request appear in the API Connector sidebar.
    udemy-img7
  4. One last step: the API response from Udemy is pretty nested, which can cause issues with rows not lining up. As a simple solution, I suggest choosing the “concatenate” report style.
    udemy-img6
  5. Click Run and you’ll see a list of 100 Music courses from Udemy, sorted by review count.
    udemy-img8
  6. Of course you can go back and edit this request to get the categories or search terms you’re interested in. This page contains a handy request builder you can use to check out different parameters: https://www.udemy.com/developers/affiliate/methods/get-courses-list/

Part 3: Handle Pagination

By default, Udemy only returns a maximum of 100 records. To get more you need to navigate through their next page URLs as described in their documentation.

In API Connector you can set up automatic pagination handling as follows:

  • URL: set up your URL as usual, making sure to include the page_size=100 parameter
  • Pagination type: next page URL
  • Field name: next
  • Number of pages: enter the number of pages you’d like to fetch
    udemy-img9

Previous Import Twitter Data to Google Sheets
Next Import Vimeo Data to Google Sheets

Leave a Comment

Table of Contents