API Guide: Activity 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 user activity data using 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 activities within the R1 Discover platform, including activity details, card selections, and question-and-answer responses.


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 activity 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.

  • 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. List Activities

Instructions:

  • Use the "List Activities" endpoint to retrieve a list of activities completed by users within a company.

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

  • Replace {companyId} with the desired company ID and optionally specify maxDays to filter by time period.

  • Include the Bearer token in the Authorization header.

Example Request:

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

Link to Documentation: List Activities


7. List Activity Cards

Instructions:

  • Use the "List Activity Yes/No Cards" and "List Activity Final Cards" endpoints to retrieve card results for completed activities.

  • For Yes/No Cards: Make a GET request to https://api.r1learning.com/api/v2/activities/company/{companyId}/cards?page={page}&limit={limit}&maxDays={maxDays}.

  • For Final Cards: Make a GET request to https://api.r1learning.com/api/v2/activities/company/{companyId}/final-cards?page={page}&limit={limit}&maxDays={maxDays}.

  • Replace {companyId} with the desired company ID and optionally specify maxDays.

  • Include the Bearer token in the Authorization header.

Example Request (Yes/No Cards):

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

Example Request (Final Cards):

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

Link to Documentation:


8. List Activity Q&As

Instructions:

  • Use the "List Activity Q&As" endpoint to retrieve questions and answers submitted by users for completed activities.

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

  • Replace {companyId} with the desired company ID and optionally specify maxDays.

  • Include the Bearer token in the Authorization header.

Example Request:

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

Link to Documentation: List Activity Q&As


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.

  • Filtering: Leverage optional query parameters (e.g., maxDays, userId, uniqueId) to refine results.

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

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

Last updated