API to list all the courses in my institution

Jump to solution
rancho
Community Member

I am brand new to Canvas.  I have never used it, but I have been asked to do some batch integrations with our other student system.  I have looked and found the correct API call for all the courses (/api/v1/accounts/:account_id/courses).  But I can not figure out what the account_id variable is in real life.  Is that my institutions id and if so where can I find that?   I am supposed to be an admin on our test site but I do not know exactly what I am looking for?  Any help appreciated.

Labels (1)
0 Likes
1 Solution
matthew_buckett
Community Contributor

For the root account (top of the sub-account hierarchy) you can use the special value of `self` which is documented on the IDs page (the top account normally has an ID of 1 but not always), so the URL would be `/api/v1/accounts/self/courses`. This API endpoint has paging enabled, so you will need to make multiple requests and page through the results. If you use the sub-account tool in an account you can browse to other accounts and the ID will end up in the URL.

However if you are wanting to process all courses in your Canvas deployment you are much better off running a Provisioning Report which is outlined in the standard canvas reports. There is an API to run reports if you want to automate it, or you can manually run these reports, download the file and the process it. Reports can also be run at a sub-account which allows you to process a subset of courses easily if you have a well designed sub-account hierarchy.

View solution in original post

0 Likes