List Activities

An overview of the List Activities endpoint

Endpoint Description

Retrieve a list of activities taken by users that are within your accessible companies (subscriptions)

HTTP Method

GET /api/v2/activities/company/{companyId}/details

Request

Headers:

  • Content-Type: application/json - Specifies that the request body format is JSON.

  • Accept: application/json - Indicates that the client expects a JSON response.

  • Authorization: Bearer {token} - A valid Bearer token must be provided to authenticate the request.

URL Parameters

  • companyId (integer, required): The id of the company (subscription) to query user activity data. Inputting 0 will return activity data for all companies and users accessible by your bearer token. Example: 0

Query Parameters:

  • page (integer, required): Specifies the page number in the pagination sequence to retrieve a specific set of results.

  • limit (integer, required): Specifies the number of records to retrieve per page, controlling the volume of data returned.

  • maxDays (integer, optional): Filters the activities based on the number of days since the activity was taken. This is useful for querying recently taken activities.

  • userId (integer, optional): The R1 id of the user. If provided, returns all activities for this user in the specified company. Example: 1234

  • uniqueId (string, optional): The integration partner ID of the user. If provided, returns all activities for this user in the specified company. Example: ABComp-R1ID-0001234

  • userActivityId (integer, optional): The ID of a specific activity taken by a user. If provided, returns details for this single activity only. Example: 1234

  • activityType (integer, optional): The type of activity. 0 for all, 1 for Pyramid, 2 for Explore. Example: 0

  • topicId (integer, optional): The ID of the topic. If provided, returns all activities taken for this topic in the specified company. Example:

  • activityId (integer, optional): The ID of the activity. If provided, returns all activities taken for this activity in the specified company. Example:

  • sortby (integer, required): Specifies the order the users should be returned in:

    • 1 - Sort by Oldest taken activity ID

    • 2 - Sort by Newest taken activity ID

Request Examples

curl --request GET \
    --get "https://api.r1learning.com/api/v2/activities/company/1/details?page=1&limit=50&maxDays=0&activityType=0&sortby=1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer {token}"

Response

Meta:

Each List endpoint will contain a meta element which will describe the returned package. In this endpoint, the meta will provide the following information:

  • total_items (Integer): The number of activities returned across all queried companies

  • total pages (integer): The number of pages returned in the call to the endpoint. (Total Items / per_page limit)

  • current_page (integer): Indicates the current page number of the results

  • per_page (integer): Indicates the number of results (topics) that will be listed on a single page. The default is 50, the limit is 100.

  • max_days (integer): Indicates the response data will include activities that have been taken within the indicated number of days going back from todays date.

  • company_id (integer): If specified, the id of the company queried for activities.

  • user_id (integer): If specified, the id of the user queried for activities.

  • user_activity_id (integer): If specified, the id of the specific single activity queried.

Data Dictionary:

  • id (integer): The unique identifier for the user activity (commonly referred to as user_activity_id).

  • user_id (integer): The unique identifier for the user taking the activity.

  • company_id (integer): The unique identifier for the company the user aligned to for the activity.

  • activity_id (string): The unique ID of the activity on R1 Discover (Ties to List Company Activities ID).

  • activity_name (string): The name of the taken activity on R1 Discover.

  • activity_type (string): The type of taken activity on R1 Discover (Overview or Sorting_Cards).

  • created_at (string): Timestamp indicating when the activity was created (formatted as a date-time).

  • updated_at (string): Timestamp indicating when the activity was last updated (formatted as a date-time).

  • completed_date (string): Timestamp indicating when the activity was completed (formatted as a date-time).

  • completed_status (string): The current status of the activity. Possible values:

    • Activity Started: The activity was started, but card activity wasn’t completed. No Card/question data available.

    • Cards Completed: The card portion of activity was completed. No question data is available.

    • Activity Completed: The activity was completed. Card & Question data are available.

  • report_url (string): URL link leading to the activity report.

  • video_completed (boolean): Indicates if the activity video was watched and completed.

Response Examples

{
    "meta": {
        "total_items": 1,
        "total_pages": 1,
        "current_page": "1",
        "per_page": "50",
        "max_days": "0",
        "company_id": "4121",
        "***comment": "UserId/ActivityId visible if included in query",
        "user_id": "21267",
        "user_activity_id": "154340"
    },
    "activities": [
        {
            "id": 154340,
            "user_id": 21267,
            "company_id": 4121,
            "topic_name": "Stages of Change (SUD)",
            "activity_id": 312,
            "activity_name": "Identify My Stage of Change",
            "activity_type": "sorting_cards",
            "created_at": "2024-04-20T15:03:11.000000Z",
            "updated_at": "2024-04-20T21:21:01.000000Z",
            "completed_date": "2024-04-20T21:21:01.000000Z",
            "completed_status": "Activity Completed",
            "report_url": "http://discover.r1learning.com/stages****",
            "video_completed": false
        }
    ]
}
Link to endpoint in Postman.

Notes

  • Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to access the endpoint.

  • Response Handling: Implement pagination to manage data effectively, especially when dealing with large datasets.

Last updated