Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
baxl
Community Member

What is an API Call to get a list of users enrolled with a particular course role?

Jump to solution

Can anyone share an API call to get a list of users enrolled with a particular course role?  I need to get a list of all users enrolled in courses with a custom created course role called Demo Viewer.  The role is based off of the observer role. 

Thanks!

Lisa

1 Solution

Accepted Solutions
garth
Community Member

 @baxl ​ use the Enrollments API, specifically the call to "List enrollments":

The "role[]" parameter should get you what you are looking for: 

role[]string

A list of enrollment roles to return. Accepted values include course-level roles created by the Add Role API as well as the base enrollment types accepted by the `type` argument above.

Let me know if this helps.

View solution in original post

6 Replies
kona
Community Coach
Community Coach

Due to the technical nature of this question I'm going to share it with the Canvas Developers​ group in the Community. Hopefully they'll be able to help!

baxl
Community Member

Thank you! 

garth
Community Member

 @baxl ​ use the Enrollments API, specifically the call to "List enrollments":

The "role[]" parameter should get you what you are looking for: 

role[]string

A list of enrollment roles to return. Accepted values include course-level roles created by the Add Role API as well as the base enrollment types accepted by the `type` argument above.

Let me know if this helps.

baxl
Community Member

Is there a way to find a list of users enrolled in an account?  For instance, we have a custom course role called Demo Viewer and I'd like to find all users that are enrolled with that type of role in a sub-account. 

garth
Community Member

 @baxl ​ have you looked at the "Provisioning" report for the sub-account?

Can you use the results for "Enrollments" to filter out what you are looking for?

baxl
Community Member

That's perfect!  That's exactly what I need!  Thanks so much!