List Activity Yes/No Cards

Overview of the List Activity Yes/No Cards

Endpoint Description

Retrieve a list of the sorting_card (pyramid) activities taken by users that are within your accessible companies (subscriptions) and view the yes/no cards selected in the first step of the activity.

HTTP Method

GET /api/v2/activities/company/{companyId}/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/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.

  • topic_id (string): The unique ID of the activity topic on R1 Discover (Ties to List Company Topics ID).

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

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

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

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

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

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

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

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

      • text (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": "1"
    },
    "activities": [
        {
            "user_activity_id": 15205,
            "user_id": 21123,
            "company_id": 123123,
            "topic_id": 111222,
            "cards": {
                "yes_cards": [
                    {
                        "selected_id": 1,
                        "model_definition": "Maintenance",
                        "text": "I practice mindfulness and patience to support my substance-free lifestyle"
                    },
                    {
                        "selected_id": 2,
                        "model_definition": "Maintenance",
                        "text": "I am grateful for quitting and living a substance-free life"
                    }
                ],
                "no_cards": [
                    {
                        "selected_id": 1,
                        "model_definition": "Preparation",
                        "text": "I have recently told others about my plans to quit"
                    },
                    {
                        "selected_id": 2,
                        "model_definition": "Pre Contemplation",
                        "text": "There is nothing I really need to change about my drinking or using;I am a fairly normal drinker or user "
                    }
                ]
            }
        }
    ]
}
Link to the 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