cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Surveyor

Canvas API course sections does not return students when included

Hi there,

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.

lars-uva_0-1599038640344.png

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.

Labels (2)
0 Kudos
1 Reply
Highlighted
Surveyor

Hi there,

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.

kind regards,
Jens