The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Looking through the API, and I cannot for the life of me figure out how to filter down by term the same way the Admin - Courses - Search page does. I basically want to delete all courses from a SPECIFIC Term that have no enrollments... maybe I'm just too dumb to use the API...
It's a little buried inside the Accounts endpoint:
https://canvas.instructure.com/doc/api/accounts.html#method.accounts.courses_api
You would just need to include the enrollment_term_id in the request so that it would only return the courses within the term you specify.
Thanks! That is helpful, but I'm struggling with a way to find the terms (or the term IDs) via the API...
You can get the terms via this endpoint:
https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index
I found that, but when I try to do things like make sure I'm only operating at the sub account level, I get messages like {"message":"Terms only belong to root_accounts."}
I guess my course deletions were working when using the root_account, but it seemed like it only did some of them... do I need to de-paginate somewhere (it looks like my code will only do 10 deletions at a time).
Like I said, I'm probably too dumb to do this with the API; but even if I can only do 10 per run of my script, it's way faster than deleting them in the GUI...
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in