I'm not even sure what is possible using the API for Content Migrations. Can you create new courses and import content into them in one process? I have found a Python and Windows PowerShell script, online, that look like they are creating courses and then importing content (various migration types) from other LMS sources. They use an Access Token for authentication, as do SIS Imports. I know you can do this via the UI, but I am looking to do several courses at a time.
With Canvas you can do just about anything by utilizing the API's they have built. At my school, we create new course shells, sections and copy content into those new course shells from "Master Courses" we have created.
Below is the URL that shows every file that you can send to Canvas and how each file needs to be setup in order for them to import it. I used this extensively when I was coding for the users, courses, sections, enrollments, drops and term creation.
This link goes through and gives example code of how to upload the files that you created above into Canvas as well as how to check the process status of that file.
The following link has example code of how to copy content from one course to another using API calls.
I have written a python script to create new courses, then create a content migration to copy content in to the new course.
This uses python 2.7 and the Python Requests module.
This python function will create a new course: [Python] Python Create Course - Pastebin.com
and this function will start a migration, then update you on its progress: [Python] Python Canvas Create Migration - Pastebin.com
Let me know if you have any questions.
We are in the process of migrating from Moodle to Canvas. We run SQL scripts to extract course information from the Moodle database and then use the Canvas API to build each Canvas course, gradebook, assignments, discussions, quizzes, LTI connection, pages. This reduced the man-hours for each shell from about 10 to less than 1. The remaining time is the QA check that is performed manually.
Thanks to all.
I’ve been playing with the “Python Create Course” script and I can’t get it to create a course, nor throw an error so I can figure out what I’m missing. The JSON items do not print out.
What is the ’ offer’ : ‘TrueOrFalse’
Also, is “account_id” the account number for the owner of the Access Token?
I found this PowerShell script for content migrations last week:
I just could not get the script to work, and now I think I had a "test" zip file with little or no content because I decided to use another zip file and voila, the content started importing and finished successfully;-)
Thanks to "kaigga" for generously providing the script!
I also came across the "Postman" API handler for Chrome which aided my understanding of how the URLs are built. And, as others have said, /doc/api/live is a great help.
Hi @bneporadny ,
Thank you for this information. My institution is still very new to Canvas and we are getting ready to pilot this fall, but I am having issues with bulk course copying from a master template. I have my API code to course copy on an individual course basis, but stumped on how to setup the POST to work and also how the file should be formatted and with what headers? I've been on Canvas LMS REST API Documentation so much lately that my eyes hurt and I am probably missing it. Do you have any insight on how I can code something to copy a template into a large number of courses at once?
Thank you! Shane
I am not aware of a way that Canvas allows us to copy the contents into multiple courses using 1 API call at this time. How I have set my code up is to pull a list of courses that my school will be offering for the upcoming term and to a foreach loop through that list and make an API call for each of those courses.
The API call should look similar to this:
I'm using C# to code this so you may have to modify the below into Python.
Example ( https://yourinsitutionhere.instructure.com/api/v1/courses/sis_course_id:Canavs101.V1/content_migrations)
Parameters: migration_type=course_copy_importer&settings[source_course_id]=" + CanvasCourseID (the actually course ID canvas gives your master course)
Example migration_type=course_copy_importer&settings[source_course_id]= 101 (the actually course ID canvas gives your master course)
Header :Bearer + your institutions integration token. Example (Bearer 1234567890)
Hope this helps.
That's what I was thinking. The script I used to copy individual Bb archives into their respective Canvas shells could be used. You would just use the same archive for each Canvas course you wanted to copy into, and you would list those in the csv file, one line for each Canvas shell.
We are giving the Canvas Admins area a little bit of love (especially questions that are really, really old) and just want to check in with you. This will also bring this question new attention.
Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment. Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.