API Guide: Video Data

An overview of accessing the R1 Discover activity data via our API.

Introduction

This guide provides detailed instructions for integration partners on how to access data related to users watching videos via Version 2 of the R1 Discover API. By following this guide, partners can efficiently integrate with the API to retrieve a comprehensive view of user video interactions within the R1 Discover platform, including company-wide and user-specific video metrics.


Prerequisites

Before starting the integration process, ensure the following:

  • You have an active R1 Discover Tech Partner account.

  • You can generate a Bearer token for authentication.

Detailed instructions for setting up your account and generating a token are available here: R1 API: Getting Started (#).


Workflow Overview

Understanding the sequence of API calls is essential for effectively retrieving user video data. This section outlines the recommended workflow for accessing the relevant endpoints in Version 2 of the R1 Discover API.

Workflow Diagram:


Step-by-Step Instructions

1. Generate Bearer Token

Instructions:

  • Log in to your R1 Discover Tech Partner account.

  • Navigate to the "My Companies" tab.

  • Click the "Key" icon to generate a Bearer token.

  • Copy the token to a secure location. Note: The token will not be visible after you leave the page.

Link to Documentation: Generate Bearer Token


2. Retrieve Company List

Instructions:

  • Use the "List Companies" endpoint to retrieve a paginated list of companies and their IDs.

  • Make a GET request to https://api.r1learning.com/api/v2/companies?page={page}&limit={limit}.

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/companies?page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List Companies


3. Retrieve Company User List

Instructions:

  • Use the "List Company Users" endpoint to retrieve a list of users associated with a specific company.

  • Make a GET request to https://api.r1learning.com/api/v2/users/{companyId}?page={page}&limit={limit}.

  • Replace {companyId} with the company ID from the previous step.

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/users/12345?page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List Company Users


4. Retrieve Company Topic List

Instructions:

  • Use the "List Company Topics" endpoint to retrieve all topics available to a company.

  • Make a GET request to https://api.r1learning.com/api/v2/companies/topics?companyId={companyId}&page={page}&limit={limit}.

  • Replace {companyId} with the desired company ID (use 0 to retrieve topics for all companies).

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/companies/topics?companyId=12345&page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List Company Topics


5. Retrieve Company Activity List

Instructions:

  • Use the "List Company Activities" endpoint to retrieve all activities available to a company, including video-related activities.

  • Make a GET request to https://api.r1learning.com/api/v2/companies/activities?companyId={companyId}&page={page}&limit={limit}.

  • Replace {companyId} with the desired company ID (use 0 to retrieve activities for all companies).

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/companies/activities?companyId=12345&page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List Company Activities


6. View Company Video Metrics

Instructions:

  • Use the "List Company Video Metrics" endpoint to retrieve a paginated list of video sessions for all users within a company.

  • Make a GET request to https://api.r1learning.com/api/v2/metrics/metrics/videos/companies/{companyId}?page={page}&limit={limit}.

  • Replace {companyId} with the desired company ID.

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/metrics/metrics/videos/companies/12345?page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List Company Video Metrics


7. View User Video Metrics

Instructions:

  • Use the "List User Video Metrics" endpoint to retrieve a paginated list of video sessions for a specific user.

  • Make a GET request to https://api.r1learning.com/api/v2/metrics/metrics/videos/users/{userId}?page={page}&limit={limit}.

  • Replace {userId} with the user ID obtained from the "List Company Users" endpoint.

  • Include the Bearer token in the Authorization header.

Example Request:

GET https://api.r1learning.com/api/v2/metrics/metrics/videos/users/17434?page=1&limit=50
Headers:
  Content-Type: application/json
  Accept: application/json
  Authorization: Bearer {token}

Link to Documentation: List User Video Metrics


Notes

  • Authentication: All requests require a valid Bearer token in the Authorization header to avoid 401 Unauthenticated errors.

  • Pagination: Use the page and limit query parameters to manage large datasets efficiently (default: 50, max: 100).

  • Error Handling: Be prepared to handle common errors such as 401 (Unauthenticated) and 403 (Unauthorized). Refer to individual endpoint documentation for details.

  • Contextual Data: Use the "List Company Topics" and "List Company Activities" endpoints to correlate video metrics with specific topics or activities that include videos.

For additional resources, explore the R1 Discover API Postman Collection or contact support at [email protected].

Last updated