Search API Connector Documentation
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.
- Before You Begin
- Part 1: Get your Udemy API Credentials
- Part 2: Create your API Request
- Part 3: Handle Pagination
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Udemy API Credentials
- 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).
- Click Request Affiliate API Client
- 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.
- 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.
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.
- 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
- Click Extensions > API Connector > Import / Export > Import cURL and paste in that snippet. It should look like this. Don't hit import just yet.
- 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.
- 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.
- Click Run and you'll see a list of 100 Music courses from Udemy, sorted by review count.
- 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.
In API Connector you can set up automatic pagination handling as follows:
- URL: set up your URL as usual, including the page_size=100 parameter
- Pagination type: next page URL
- Next page path: next
- Run until: choose when to stop fetching data
Part 4: API Documentation
Official API documentation: https://www.udemy.com/developers/affiliate/