How can I find term id for a course programatically or via Web Interface?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I run a script that I created in Python and I use the term_id fo filter some of my results.
I want to know if is it possible to find the respective term id for a course using the course id?
The answer could be programatically or via Canvas Web Interface.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. The courses object includes an enrollment_term_id, which is the Canvas ID for the course. This is not a friendly name, though, but an integer.
You can get a list of all of the courses and get the human-friendly name by using the List your courses endpoint and adding a query parameter of include[]=term. Note that your courses means the courses of the user with the API token, which is not what you want if your token belongs to an admin.
You can also List courses for a user and include[]=term, but you have to have a token for an administrator to do that.
You can Get a single course and include[]=term, but you must be an administrator or be enrolled in that course.
Unless your token belongs to an administrator account, you cannot get a list of terms separately. The List enrollment terms endpoint can provide a list of all of the terms that are available, but you'll get an unauthorized error with the right level of permissions on the token.