Currently if you want to get a list of all of the roles in a Canvas instance you need to do the following:
- Load all sub-accounts from the root account: https://canvas.instructure.com/doc/api/accounts.html#method.accounts.sub_accounts
- For every sub-account from #1, load the roles under that account: https://canvas.instructure.com/doc/api/roles.html#method.role_overrides.api_index
The end result of those two steps is a list of all the roles under every account in Canvas. The trouble is that step #2 takes a pretty long time to complete, for a pretty small amount of data. The API in #1 gives the option of a "recursive" parameter. If you pass that parameter it returns every sub-account in the hierarchy (without having the loop through).
The API in #2 could do exactly the same. It could accept a "recursive" parameter that gives all the roles under the entire hierarchy.
Interestingly the API in #2 provides a "show_inherited" parameter. This does the reverse of what I am looking for. It shows all roles "inherited", higher up in the Canvas hierarchy, rather than roles that lower in the hierarchy. My point is this shouldn't be too hard to implement because the reverse already exists.
To summarize the request: Add a "recursive" parameter to the Canvas Roles API.
Please note that it would be useful to extend this idea to all account level API endpoints, just like the courses endpoint does. Perhaps it is worth solving this problem at a broader scale rather than this one specific case.
The account admins endpoint is an example of another endpoint that could benefit from the "recursive" parameter: Admins - Canvas LMS REST API Documentation