API to get sections information doesn't return enrollments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to get a list of enrollments (all participants including faculty and students) in a section. The token should be privileged to do this, do I doubt that's the problem.
When listing students in a section, everything looks fine:
curl --location
--request GET 'https://ouruniv.instructure.com/api/v1/sections/1642107?include=students' \
--header 'Authorization: Bearer TokenGoesHere' \
--header 'Cookie: CookiesGoHere'
But when I run enrollments (I need faculty listed as well as students), nothing shows up:
curl --location
--request GET 'https://ouruniv.instructure.com/api/v1/sections/1642107?include=enrollments' \
--header 'Authorization: Bearer TokenGoesHere' \
--header 'Cookie: CookiesGoHere'
{
"id": 1642107,
"course_id": 1402774,
"name": "SU-22-BIOL-350-RN7A PATHOPHYSIOLOGY",
"start_at": null,
"end_at": null,
"created_at": "2022-03-30T21:20:51Z",
"restrict_enrollments_to_section_dates": null,
"nonxlist_course_id": null,
"sis_section_id": null,
"sis_course_id": "SU-22-BIOL-350-RN7A-OnL",
"integration_id": null,
"sis_import_id": null
}
Any idea what could be causing this? I tried "enrollment" and "enrollments" and hopefully won't have an embarrassing petition for help with a misspelled word.
TIA.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @VicKovacs!
When returning section enrollments via API, teacher enrollments are not going to be included.
It seems that what you are going to want is the enrollment API, where you can add a parameter for a specific sis_section_id to be returned. You can then filter that enrollment endpoint to include StudentEnrollment and TeacherEnrollment.
It would come out looking something like this:
https://yourinstance.instructure.com/api/v1/courses/course_id:/enrollments?sis_section_id[]=sis_section_id:&type[]=StudentEnrollment&type[]=TeacherEnrollment