List Company Admins

An overview of the List Company Admins Endpoint

Endpoint Description

The List Company Admins endpoint provides the list of admins associated with a specific company within R1 Discover.

HTTP Method

GET /api/v2/admins/{companyId}

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 Admin data. Inputting 0 will return admins for all companies 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 users based on the number of days since their last activity. This is useful for identifying inactive users or recently active users.

  • userStatus (integer, optional): 1 = active, 2 = inactive, default 0 which returns all users. Example: 0

  • uniqueID (string, optional): The unique ID of the user from the integration partner system. Example: abcomp-user-1234

  • location_id (integer, optional): Pull users from a location, defaults blank to returns all records. Example: 1234

  • program_id (integer, optional): Pull users from a Program, defaults blank to returns all records. Example: 5678

  • practitioners (integer, optional): Pull only admins designated as practitioners. (0 returns all admins, 1 returns practitioners only). Example: 0

  • sortby (Integer, Required): Specifies the order the Admins should be returned in:

    • 1 - Sort by Oldest Admin ID

    • 2 - Sort by Newest Admin ID

    • 3 - Sort by Least Recently Active Admins

    • 4 - Sort by most Recently Active Admins

Request Examples

curl --request GET \
    --get "https://api.r1learning.com/api/v2/admins/0?page=1&limit=50&maxDays=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 admins returned

  • 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 admins that have been active within the indicated number of days going back from todays date.

Data Dictionary:

  • company_id (Integer): The unique identifier for the company within the R1 Discover system.

  • admins (object): The package of the specified company locations

    • user_id (integer): The unique identifier for the user within the R1 Discover system. This is used internally to reference the user across the R1 Discover system.

    • email (string): The email address of the user. This is used for user login and communication purposes.

    • username (string): The username of the user in the R1 Discover system. This may be used for user identification within the platform.

    • unique_id (string): The shared ID of the user between R1 Discover and an integration partner.

    • admin_type (string): The type of admin (practitioner, executive, etc...) .

    • role_name (string): The permissioned role of the admin. (Super Admin, Lead Admin, etc..)

    • default_location (string): The name of the location the admin data aligns to within R1 Discover.

    • default_program (string): The name of the program the admin data aligns to within R1 Discover.

    • status (string): Indicates whether the user is currently "active" or "inactive" within

    • member_updated_at: The date this user record was last updated.

    • last_activity_date: The date the user was last active within R1 Discover.

Response Examples

{
            "company_id": 612,
            "admins": [
                {
                    "user_id": 12345,
                    "email": "[email protected]",
                    "username": "johnsmith",
                    "unique_id": "admin-r1-000000000012345",
                    "admin_type": "Company Admin",
                    "role_name": "Super Admin",
                    "default_location": "R1 Location 1",
                    "default_program": "PHP",
                    "status": "active",
                    "member_updated_at": "2024-09-15T00:51:20.000000Z",
                    "last_activity_date": "2024-01-07T16:50:19.000000Z"
                }
            ]
        }
    ]
}
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