How can I get a user's sections for a course, from the Canvas API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I get a list of all of a given user's sections for a given course, including both the ID and name of each section (not just the IDs), from the Canvas API?
Importantly the user in question is not the authenticated user, it's an arbitrary user that's different from the user who I'm authenticating the API as.
Ideally we'd like to be able to do this in a single API call, since we need to get this info on every LTI launch and the more API calls we need to make during our launch process the longer the user has to wait.
So far I've been able to figure out that you can get a list of the authenticated user's section like this:
http GET "https://FOO.instructure.com/api/v1/courses/<COURSE_ID>?include[]=sections" Authorization:"Bearer 9382~c7I***A8v"
You can get a list of all sections in a course like this:
http GET "https://FOO.instructure.com/api/v1/courses/<COURSE_ID>/sections" Authorization:"Bearer 9382~p5X***L9y"
You can even get a list of an arbitrary user's (not the authenticated user's) sections like this, but it includes only the section IDs not the names:
http "https://FOO.instructure.com/api/v1/courses/<COURSE_ID>/users/<USER_ID>?include[]=enrollments" Authorization:"Bearer 9382~1sN***oaZ"
But none of those are what I need. So far, I've been unable to get the list of course sections for a user other than the authenticated user and with the section names not just the IDs.
Does anyone know of a way to do this?
Thanks