I am using Canvas LMS - REST API and I need to retrieve all roles for a specific course. Does that API exist?
Due to the technical nature of this question I'm going to share it with the Canvas Developers group in the Community. They are the ones that work with this side of Canvas and should hopefully be able to help! In addition, you might consider joining the Developers group and checking out some of their other resources/information!
Hi Gwowen Fu...
While I don't have an answer for you, I wanted to check in with you because it's been about two months since any new activity in this particular discussion topic. It appears that you may have stumped members of the Canvas Community. Since your initial question, have you been able to come up with any solutions on your own that you would be willing to share with us here in the Community? Or, are you still seeking assistance with this question? Looking forward to hearing from you soon.
Course roles are tied to enrollments, so you would need to get a list of all enrollments for a course and then look at the roles of the people.
The list users in a course endpoint might be a starting point. You can add the query parameter include=enrollments to get a list of the enrollments.
It returns a list of users and there will be an enrollments object for each person. It's an array of enrollment information, one for each role the person has.
Here's an example of a custom role we have:
You then can iterate through the list and collect the information you need.
Hello Gwowen Fu...
It has been several months since you first posted this question in the Canvas Community and received some replies from Community members. So, I thought I would check in with you. Have you had an opportunity to review the response from James Jones? If so, did it help to answer your question? Or, are you still looking for some help from members of the Canvas Community? If you feel that James' response did answer your question, please feel free to mark it as "Correct". However, if you are still looking for some help, please post an update below so that the Community can continue to assist you. For now, because we've not heard from you since January, I'm going to mark your question as "Assumed Answered", but that won't prevent you or others from posting additional replies below. I hope that's okay with you. Looking forward to hearing from you soon, Gwowen.
Retrieving data ...