I am trying to get a list of all the students in all the sections connected to a course using the Canvas API. However, I cant seem to workout how the 'include' param should work. When using the following bash command:
curl http://canvas.docker/api/v1/courses/1/sections\?include\[\]\=students -H "Authorization: Bearer ACCESS_TOKEN"
I only get a list with the keys shown in the screenshot.
Also when trying other include values stated in https://canvas.instructure.com/doc/api/sections.html#method.sections.index, nothing seems to get me more information. The access token is taken from the admin account and there is a student connected to the section. What could I be doing wrong?
Thank you in advance.
you might want to put your request URL in quotation marks and leave out the escape characters instead. If you want to include several different options, use the include=... again by adding a new argument:
curl "<API_URL>/api/v1/courses/1024?include=teachers&include=term&include=concluded" -H "Authorization: Bearer <TOKEN>"
Works for me.