cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
giddyg
Community Participant

Canvas automated backups - Automated course exports

Jump to solution

I have to make full backup of the Canvas LMS, so I'll backup canvas code (excluding logs), database, and I'd like to backup individual courses also. Is there a way to export canvas course using command line in Linux? I'd like to be able to export courses for example as common cartridge files using terminal, so I could automate the process. And sometimes it's easier to restore a course than to do restoration of the full site.

1 Solution

Accepted Solutions
levi_magnus
Community Participant

Hi giddyg‌,

You can export courses through the Canvas LMS REST API. Using the Content Exports API, you can export a course using the following endpoint: POST /api/v1/courses/:course_id/content_exports . You can track the progress of the export with the Progress API (progress is linked to with the progress_url value of the ContentExport object) and when it is complete use the show content endpoint, GET /api/v1/courses/:course_id/content_exports/:id, to retrieve a download URL for the exported content.

View solution in original post

4 Replies
levi_magnus
Community Participant

Hi giddyg‌,

You can export courses through the Canvas LMS REST API. Using the Content Exports API, you can export a course using the following endpoint: POST /api/v1/courses/:course_id/content_exports . You can track the progress of the export with the Progress API (progress is linked to with the progress_url value of the ContentExport object) and when it is complete use the show content endpoint, GET /api/v1/courses/:course_id/content_exports/:id, to retrieve a download URL for the exported content.

View solution in original post

giddyg
Community Participant

Thank you  @levi_magnus ‌! It's unfortunate that I can't do this through the command line. This is more a "pull" approach, and I'd need something like "export through command line and push to backup server" approach Smiley Happy

marqpdx
Community Member

This actually could happen through the command line.

You just write a simple shell script and run it from the command line. You'd use `curl` to call the REST API, and then `curl` again to download the file, then you'd have the file on the machine where the script is called, then you can `ftp` it from there to where you want. would only be a few lines of code i suppose.

Was thinking of this myself. Should work Smiley Happy

giddyg
Community Participant

That's actually a very good idea. Thank you! Although, It's shame that there's no command line utility made by instructure for that. Moodle has such a tool for a long time.