Hi There,
I am a developer for an application which utilizes Canvas' REST APIs to get data related to users, user roles, course enrollments, etc.
The focus of this post is to try and see if one of the available endpoints to detect admin roles would work with custom admin roles. Here is the scenario:
I use the "List account admins" endpoint (https://canvas.instructure.com/doc/api/admins.html#method.admins.index) to detect whether a given user has an admin role. I pass a user_id into the user_id[] parameter. Here is a sample GET request that the application makes:
GET api/v1/accounts/self/admins?user_id[]=462
The user 462 is set up as a custom admin role in this account. It is not using the standard "Account Admin" role, but it is using a custom admin role with a mostly matching set of privileges to AccountAdmin. However, making a GET request to the admins endpoint in this user's context produces a response with status 401 and the following message:
{"status":"unauthorized","errors":[{"message":"user not authorized to perform that action"}]}
The Canvas API documentation doesn't explicitly state exactly what privilege or authorization level is needed to make this request.
- How can we can adjust our custom Admin role so that it is authorized to make a valid request to the admin endpoint?
- Can custom admin roles be detected using any other endpoints? I was unable to find any in the API documentation