cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lars-uva
Community Member

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 (1)
Tags (2)
0 Kudos
1 Reply
jenerous
Community Member

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