Hello! I was just tinkering with a Java library for the API and I was wondering how I could access the list of students specific to a section. I am very new to this, so any help is appreciated!
Hi @srihari_n_yenam and welcome to the Canvas Community! I don't work with Java and APIs much, but am going to share this question with the https://community.canvaslms.com/groups/admins?sr=search&searchId=b594a066-9477-4024-9d11-0664aa93b4a... and https://community.canvaslms.com/groups/canvas-developers?sr=search&searchId=2d86f25b-2801-40e9-9970-... groups to increase its visibility and in hopes that someone can provide useful insight. If you have not already done so, you might consider joining these user groups as well.
All the best!
You can accomplish this by using the list-users-in-course api
Another thing you can use is the live api to test you call without having to write any code and see the results you would receive back from the call.
Hope this helps.
You can probably approach this one of two ways, depending on how you will apply the data. The easiest way I could see would be to run a canned provisioning report from Canvas for enrollments. This should list the students, instructors, TAs, etc. in a given course and term, and from there you can filter the CSV for the section you want. You can do this by going to the Admin Sheild => Settings => Reports => Provisioning => Enrollments => Filter by term => Export.
However, to approach this programatically (full disclosure I am not a coder so this may be a primitive approach), would be to first get the sections for a course (assuming you already had the course IDs handy) with:
Then, using the json response, and section ID from that call, make the next call for enrollments by section with:
As @bneporadny mentioned above, you will definitely want to check out the documentation as there are different parameters and calls you can make to get the specific information you need.
I hope this helps.
If your Canvas sections have SIS IDs, then you can get the enrolments for a specific section with:
You can limit these to student enrolments with the type parameter.
Or you can call the course endpoint and specify specific sections.
As you say you are very new to this, one thing a lot of people miss is pagination, make sure you read Pagination - Canvas LMS REST API Documentation and also the different ways of referring to objects: Object IDs, SIS IDs, and special IDs - Canvas LMS REST API Documentation
Thank you for your response! I was looking under list-users-in-course, and I couldn't seem to find any mentions of sections under that part of it, but I'm not sure how I would go about implementing it anyways. Also, I'm having trouble understanding how to test using the live API. Sorry for the very basic questions, but I'm very new to this. Thank you for your help!
Hi @srihari_n_yenam ,
When you go to the live api web page at the top of the screen you will need to entered in your authentication token
Once you have entered in your authentication token and clicked the Save token button you will want to scroll down until you see the enrollment api section and click on the one shown in the screen shot below.
Once there scroll down and you will see where you can entered in the Canvas course SIS ID
Entered in the Canvas course SIS ID (you may have to go to the course and find it in the URL
Once you have entered in the course_id click try it out and you will see the json results you would receive back if you called it via code.
I have found using the #live api page very useful in testing out Canvas's API's and ensuring I am going to be calling the correct one prior to putting any development time.
Hope this helps.