Find a Course by SIS Course ID, when given only part of that SIS ID?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my custom application, I have a program that successfully searches for and finds a course when given its SIS Course ID. Using this code written in PHP Laravel:
$sis_course_id = $request->sis_course_id; //gets the SIS Course ID
$courseURL = "https://my.instructure.com/api/v1/courses/sis_course_id:$sis_course_id"; //parsed into a cURL request, gets the data from this endpoint with the matching SIS Course ID.
This code works perfectly if I have the precise SIS Course ID as saved in the Canvas endpoint. But it fails if I type in only part of that SIS Course ID, which is what I've been asked to do. Instead of the full course name (e.g "xxx-somePhraseWithNumbers11Here"), they want it possible to search with just a fraction of that (i.e the "somePhraseWithNumbers11Here" part, without the "xxx-" portion.
I've been reviewing the Canvas documentation on the courses endpoint once again, but if what I am looking to do is listed in there as a function, I seem to have overlooked it.
Is it possible to find a course given only part of its SIS ID? Any thoughts would be very useful
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rather than the course endpoints, look at the account ones. This might be of use:
.../api/v1/accounts/1/courses?search_by=course&search_term=xyz
Results will be broader than you want as it searches names and codes as well as SIS IDs. So you will need to filter the results.