List Activity Final Cards

An overview of the List Activity Final Cards endpoint.

Endpoint Description

Retrieve a list of the activities taken by users that are within your accessible companies (subscriptions) and view the final cards selected in the activity. For sorting cards (pyramid) activities, it's the final pyramid cards, for overview (explore) activities it's the final select model cards.

HTTP Method

GET /api/v2/activities/company/{companyId}/final-cards

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 cards data. Inputting 0 will return activity cards 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/final-cards?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:

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

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

  • cards (object): The collection of yes and no cards returned from the query.

    • sorting_cards activity type: Cards returned in the sorting_cards (pyramid) activity type

      • pyramid_id (integer): The id of selected cards position in the pyramid (1 means top card)

      • model_category (string): The model category of the selected card

      • card_detail (string): The card text of the selected card

    • overview activity type: Cards returned in the overview (explore) activity type

      • selected_id (integer): The selected id of the no card (1 means first no card selected)

      • model_category (string): The model category of the selected card

      • card_detail (string): The card text of the selected card

Response Examples

{
    "meta": {
        "total_items": 1,
        "total_pages": 1,
        "current_page": "1",
        "per_page": "50",
        "max_days": "0",
        "company_id": "4132",
        "***comment": "UserId/ActivityId visible if included in query",
        "user_id": "2157",
        "user_activity_id": "15026"
    },
    "activities": [
        {
            "user_activity_id": 15026,
            "user_id": 2157,
            "company_id": 4132,
            "cards": [
                {
                    "pyramid_id": 1,
                    "model_category": "Maintenance",
                    "card_detail": "I love my substance-free life and act daily to keep it"
                },
                {
                    "pyramid_id": 2,
                    "model_category": "Maintenance",
                    "card_detail": "I practice mindfulness and patience to support my substance-free lifestyle"
                },
                {
                    "pyramid_id": 3,
                    "model_category": "Maintenance",
                    "card_detail": "I am grateful for quitting and living a substance-free life"
                },
                {
                    "pyramid_id": 4,
                    "model_category": "Maintenance",
                    "card_detail": "I participate in healthy activities to avoid stress and reduce anxiety"
                },
                {
                    "pyramid_id": 5,
                    "model_category": "Maintenance",
                    "card_detail": "I am managing risk situations and/or temptations (triggering people, places, things, and situations) "
                },
                {
                    "pyramid_id": 6,
                    "model_category": "Maintenance",
                    "card_detail": "I am serving and supporting others who are not using substances"
                },
                {
                    "pyramid_id": 7,
                    "model_category": "Action",
                    "card_detail": "I am asking others for help"
                },
                {
                    "pyramid_id": 8,
                    "model_category": "Action",
                    "card_detail": "I am connecting with others and building a new network of healthy non-drinking or using friends"
                },
                {
                    "pyramid_id": 9,
                    "model_category": "Contemplation",
                    "card_detail": "I can see the benefits of quitting more clearly"
                },
                {
                    "pyramid_id": 10,
                    "model_category": "Action",
                    "card_detail": "I am not drinking or using, one day at a time"
                }
            ]
        }
    ]
}
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