Using the LMS365 API, it's possible to get a list of all the roles that are assigned to a user or a group. This article describes how to get a list of these roles.
To get the roles assigned to a user or group, follow these steps:
2. Find the RolesAssignments section, expand it, find the GET method /odata/v2/RoleAssignments with the Returns the list of role assignments description, and then select Try it out in the top right-hand corner.
3. You can use query options parameters to control the data in the response.
If no query option parameters are used for the fields, the response will contain information about all role assignments of the tenant.
For example, you can use the ID of the user or group in question to narrow the response and get a list of the roles assigned to a specific user or group. To do this, in the $filter field, enter UserId eq <id of the user or group in question>, for example UserId eq d822c362-5b86-41b0-8261-57220470c89f.
For another example, we want to get a list of role assignments within a specific course. To do this:
- In the $expand field, enter User($select=PrincipalType) for the response to include the PrincipalType parameter, indicating who was assigned the role (a user or a group).
- In the $filter field, enter RoleScope/CourseId eq <ID of the course>, for example RoleScope/CourseId eq 09e99b42-9000-4b18-a818-9e7964547013.
In this example, the response will show a list of all role assignments of the course with the PrincipalType parameter, indicating whether the role is assigned to a user or a group.
4. Select Execute to run the request.
5. Go to the Responses block to check the results:
- Number 2xx (for example, 200) under Code shows that the request worked correctly.
- In the Response body field, you'll see a list of roles assigned to users and groups of all the course catalogs of the tenant and their data, including the ID. With query options parameters set, the response will contain only the relevant data and details.
- Search for a specific user or group using Ctrl+F and copy it to use wherever you need. You can use the Download option to save the results of the API request to your computer in .JSON format.
The Role can be any of the following:
- Learner. User or group is enrolled in the course or training plan.
- LMSAdmin. User is assigned as an LMS admin.
- CourseAdmin. User or group is assigned as an admin of a course or training plan.
- CourseCatalogAdmin. User is assigned as an admin of a catalog.
- CourseSessionInstructor. User is assigned as a session instructor.
- CourseCatalogVisitor. User is added to the Users list of a specific catalog.
- CourseVisitor. User is added to the target audience of a specific course.