API query parameter syntax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working with the Enrollments endpoint, and the live API displays the following request URL when filtering on enrollment type:
.../api/v1/courses/2624/enrollments?type[]=TeacherEnrollment&type[]=StudentEnrollment
The intention being to limit the results to enrollment objects with a type of either TeacherEnrollment OR StudentEnrollment.
And though this syntax appears to be working, can I form this any another way?
E.g., ...?type=TeacherEnrollment,StudentEnrollment&...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to append it with &paremeter[]=xyz¶meter[]=abc and to filter by enrolment status, append this parameter state[] in your request. E.g.
/api/v1/courses/(course id)/enrollments?type[]=TeacherEnrollment&type[]=StudentEnrollment&state[]=active&state[]=invited
If you want to get a full list of enrollments for a course, simply send a request to /enrollments without any parameters.
For JSON, you can use Postman and follow the instructions here: https://community.canvaslms.com/t5/Canvas-Admin-Discussion/API-POST-Global-Announcement-to-Specific-...
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.