Roles API Endpoint - Course Roles?

Jump to solution
themidiman
Community Champion

Re: Roles API Endpoint Docs. I'm looking to see a representation of a custom course role at a sub-account. I don't see any endpoints to return data other than what's representative of an Account role. We need to see a data matrix of a course role that is defined within an account. See screenshot of what you can see in the UI:

 

Account Vs Course Roles in Admin UIAccount Vs Course Roles in Admin UI

How does one pull just course roles from within an account?

Thanks in advance!

Labels (3)
0 Likes
1 Solution
JamesSekcienski
Community Coach
Community Coach

@themidiman 

You will want to use the List Roles endpoint.

GET /api/v1/accounts/:account_id/roles

I know it says the "account_id" request parameter is required, but I haven't included it before and it worked.

I usually include the "show_inherited" request parameter set equal to true to get any roles that may be defined in parent accounts, but you may not need this if you are only looking at what is defined at the specific account level.

When looking at the results, those that have a "base_role_type" of "AccountMembership" will be account roles.  However, the other base role types indicate course roles (i.e. "StudentEnrollment", "TeacherEnrollment", "TaEnrollment", "ObserverEnrollment", "DesignerEnrollment").  There is also an "is_account_role" property that you can check.

I haven't found a way to exclude the account roles from the request results, but they can be filtered out if you only want to look at course roles.

View solution in original post