Found this content helpful? Log in or sign up to leave a like!
Canvas API only returns courses that I created, How can I return all courses on the instance ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the canvas api to retrieve all courses from my canvas instance.
In order to do this I :
- create a new access token in /profile/settings
- Then use this access token to perform an API call to list all courses with https://canvas.instructure.com/doc/api/courses.html#method.courses.index
This works well. However the API only returns the courses that I have specifically created. I need to return all the courses from the canvas instance.
Am I missing something ? What should I do to be able to access all courses ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@DavidGeismar2 Welcome, and welcome to using the API!
You'll want to use the following API endpoint to GET the courses from a specific account/subaccount:
<your canvas URL>/api/v1/accounts/<account ID>/courses
Your root account ID I believe is 1 (one) but as a pro-tip if you ever need to get a subset of courses that live in a specific subaccount, you can use the subaccount ID to access a list of just those courses. This helps in larger Canvas instances.
Hope this helps!
Edit: Found the name of the call you're making (I've been using the API for so long that I don't really look at the docs anymore) -- it's called List active courses in an account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To add to what Melody wrote, if you look at the top of the documentation you pointed to, you sees "Returns the paginated list of active courses for the current user." It's not specifically course that you created, but courses where you are enrolled. If you are only enrolled in all courses you create, it would be the same list. But if you were added to some other courses, they would show up there, too.
The endpoint you found works for all users, including students. The endpoint that Melody gave for the whole institution needs a token from an administrator.