Technical Whitepaper

Extracting Data from Pluralsight API

V1.0 last revision 5/1/17

ProServ

EXAMPLES

Introduction

This document describes good practices regarding the implementation architecture for pulling data via Pluralsight’s API. The approach requires a Rest API connector to connect to Pluralsight. The document includes examples of implementations. However, each implementation is unique and has to be customized, which is why it is important that each solution is thoroughly tested before used in production.


Overview of API

The basic principles of an API in Pluralsight are accessibility and automation of data. In order to automate your data extracts, the api token (which is accessible to administrators of the plan) needs to be recorded and saved in a safe place. The API token can be found by adding your plan id to the following link: https://app.pluralsight.com/plans/account/ /integrations.

This approach allows any reporting solution (e.g. Qlik, Tableau, Domo etc) to programmatically extract data without depending for a schedule .csv file.

The procedure for calling the API from a reporting tool is as follows:

  1. The reporting tool makes an HTTP request to Pluralsight’s API endpoint, passing a token in the request.
  2. Pluralsight’s API server validates the token
  3. Pluralsight sends back the relevant data in the form of a .csv.

The first step is handled by the external reporting tool when making the API call. The second and third step is performed by Pluralsight. This document describes the high level workflow on how to pull out data from our APIs. It also examines how to pull data out from some of the most common BI vendors in the market.


Architecture

The figure below provides an overview of the workflow when making an API call. The Application refers to either using a scripting language (e.g. python, bash etc) or a tool (e.g. Qlik, Tableau, PowerBi, etc).


Known Limitation

The API is capable of retrieving historical data within the past year from the day you make the call. For example, if you make an API call on April 1, 2017, you can make a request to retrieve data between April 1, 2016 to April 1, 2017. If you need any more historical data prior to one year, please reach out to professionalservices@pluralsight.com or your Account Executive.

Please include your plan-id (https://app.pluralsight.com/plans/account/your-plan-id), the data you require , and the time tables. Someone from the professional services team at Pluralsight will be in contact to assist.


Examples

Leveraging Postman (Chrome Extension)

The fastest way to become familiar with the API is by using  POSTMAN . Postman is a powerful GUI platform that makes testing API request fast. All the screenshots below uses Postman’s chrome extension, which you can add it by click  here .

After finishing the installation, please launch Postman. You will see a window similar to this one:

Making an API Call

Leveraging the course completion API, found  here , you can make a GET request within Postman to see the response of that API. Copy and past the following: https://app.pluralsight.com/plans/api/reports/v1/course-completion/{plan-id}?token={reports-api-t oken} where you need to replace the {plan-id} and {reports-api-token} with your plan id and token id and paste it next to the GET input box in Postman.

In the body of Postman you will either see a success response or an error response. Click here to find the response structure. 

List of API

Below is a list of the various API calls available within Pluralsight:

API API Description API URL
Users Returns a list of users on the account. https://app.pluralsight.com/plans/api/reports/v1/user s/?token=
Course Completion Returns a list of courses that users have completed in the last year. https://app.pluralsight.com/plans/api/reports/v1/cour se-completion/?token=
Course Usage Returns course usage for users in the last year. https://app.pluralsight.com/plans/api/reports/v1/cour se-usage/?token=
Course Catalog Returns the latest course catalog. http://api.pluralsight.com/api-v0.9/courses

Custom Scripting with Python

You can find a simple python program to download reporting data from Pluralsight API. You will need to have python3 installed along with optional packages (requests, argparse). You can find the repo and documentation here:  https://github.com/sharadg/pluralsight_api


BI Tool Connection Examples

Pluralsight Provides the following example of connecting into a BI tool like Qlik. Below is included diagrams of dataflows with Power BI, Domo, Tableau, and Qlik.

Qlik

Qlik  is a software company based in Radnor, Pennsylvania, United States. Qlik is the provider of QlikView and Qlik Sense, business intelligence & visualization software.

If your analysis only requires historical data from within the past year, you can simply create a connection string to the Pluralsight API in QlikView by going to the “Edit Script” window and click the “Web Files...” button. Paste the appropriate API URL into “Internet File” field as shown below and click “Next”

In the “Labels” dropdown, select “Embedded Labels” and then click “Finish” as shown below:

In Qlik Sense, you can create the optional connection string by hitting the “Create new connection” button in the Data load editor. Paste the appropriate API URL into “URL” field as shown below:

Due to a Known Limitation , if your analysis requires historical data older than the past year, a different approach is needed. Below depicts a typical workflow of getting historical data (one time dump) and a daily delta of the data. 

Each time Qlik calls the API it will create a daily QVD, that serves as a snapshot of the received data.

The Qlik Dashboard will pull in both the initial upload, and the daily QVDs to provide a holistic snapshot of usage.

To create the daily QVD files, you will need a load script like that shown below for Course Usage, replacing the {plan-id} and {reports-api-token} with your plan id and token id:

& '$(vStartDate)'
& 'endDate='
& '$(vEndDate)';

 trace $(vConnectionString);

 '$(vQVDFileName)':

 LOAD UserId, FirstName, LastName, Email, TeamName, Note, IsOnAccount, CourseId,
 CourseName, ViewDate, UsageInSeconds
 FROM
 $(vConnectionString)
 (txt, utf8, embedded labels, delimiter is ',', msq);

 STORE '$(vQVDFileName)' INTO $(vQVDFileName).qvd;

To pull in all of the daily QVD files, make sure that they follow a consistent file name convention. In our example, the QVD file names all contain “_course_usage_”, so we can load in all them using this statement:

 LOAD *
 FROM
 *_course_usage_*.qvd
 (qvd);

Power BI

Tableau

Domo

Domo is a business intelligence tool based out of American Fork, Utah. Below depicts the typical workflow of moving both historical and recurring data into Domo.

Appendix

Dashboard Examples

Tableau:
Domo
Qlik