Showing results for 
Show  only  | Search instead for 
Did you mean: 
New Member

How do I find a course by name?

My current project asks me to develop a webpage that allows someone to find a single course, if given its name or ID. Let's say name, for now. To that end, I'm following the official documentation here

The two sections that seem most useful are "List Your Courses" and "Get Single Course". The latter being more precise to what I want.
However, I'm conscious that the users I'm developing this for may not always have the course IDs on hand. Therefore, I'd like them to be able to find the course details on Canvas with just the course's name.
I've reviewed the request parameters for both, but I don't see an option to search by name. I see things like "enrollment_type", "enrollment_role_id", "teacher_limit". etc. Even in "include[]", the optional parameters there cover things like scores, accounts and terms, but not the course name.

I do not know yet if my department will be able to use just the course IDs to searhc. So just in case, it'd be very handy to be able to search by the name as a backup. Is it possible to make an endpoint request from Canvas like I'm looking for?

Labels (3)
2 Replies
Community Contributor

HI Lee,

The short answer is “no, it’s not possible”. The human-readable Canvas course names and short names aren’t guaranteed to be unique—in fact, if your institution is anything like most, they’re virtually guaranteed to not be unique. There might be 20 courses named “Composition 101” or “Introduction to Chemistry”. Some names might be unique, of course, but Canvas can't guarantee that, so it can never return a single response to a name search; it has to return a list, even if that list only has one element.

If your course names are, in fact, unique, then List Active Courses in an Account with an appropriate ‘search_term’ should do what you want:

If your users have access to your institution’s SIS Couse ID as well as the name, you can also use that to fetch the course instead of the Canvas course id. Instead of GET /api/v1/courses/

Community Contributor

Sorry, it looks like the email responder dropped some things.  That should be:

Instead of GET /api/v1/courses/<xxxx>, call GET /api/v1/courses/sis_course_id:<xxxxxxxxxxxxxxxxxxxxxxx>