List Company Users
An overview of the List Company Users endpoint
Endpoint Description
The List Company Users endpoint provides the list of users associated for a specific company setup within R1 Discover.
HTTP Method
GET /api/v2/users/{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 User data. Inputting 0 will return users 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
sortby (Integer, Required): Specifies the order the users should be returned in:
1 - Sort by Oldest User ID
2 - Sort by Newest User ID
3 - Sort by Least Recently Active Users
4 - Sort by most Recently Active Users
Request Examples
curl --request GET \
--get "https://api.r1learning.com/api/v2/users/0?page=1&limit=50&maxDays=0&userStatus=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 users 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 users 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.
users (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.
company_username (string, nullable): The unique username tied to a specific company in R1 Discover, if applicable.
unique_id (string): The shared ID of the user between R1 Discover and an integration partner.
status (string): Indicates whether the user is currently "active" or "inactive" within
location_name (string): The name of the location the user is aligned to within R1 Discover.
program_name (string): The name of the program the user is aligned to within R1 Discover.
practitioner_email (string): The email of the practitioner the user is aligned to within R1 Discover.
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": 127,
"users": [
{
"user_id": 29673,
"email": "[email protected]",
"username": "[email protected]",
"company_username": null,
"unique_id": "compid-user-000000000000946",
"status": "active",
"location_name": "R1 Location 1",
"program_name": "Sample Program",
"practitioner_email": "[email protected]",
"member_updated_at": "2023-07-20T14:21:17.000000Z",
"last_activity_date": "2023-08-25T11:06:32.000000Z"
}
]
},
{
"company_id": 393,
"users": [
{
"user_id": 21333,
"email": "[email protected]",
"username": "[email protected]",
"company_username": null,
"unique_id": "compid-user-000000000002341",
"status": "active",
"location_name": "Company Location 2",
"program_name": "PHP",
"practitioner_email": "[email protected]",
"member_updated_at": "2023-06-11T13:06:59.000000Z",
"last_activity_date": "2023-09-15T12:13:49.000000Z"
}
]
}
]
}
Postman Link
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