[ARCHIVED] While using the content migrations API to copy a particular module of 1 course to another, I end up copying the entire course.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to copy a particular module from 1 course to another. Here are the steps I followed:
1) Create a content migration:
curl -H 'Authorization: Bearer <Token> https://canvas.instructure.com/api/v1/courses/<course_id>/content_migrations \
-F 'migration_type=course_copy_importer' \
-F 'settings[source_course_id]=<id> \
-F 'selective_import=true'
This step worked fine
2) Get a list of all the modules from the source course:
curl -H 'Authorization: Bearer <Token>' https://canvas.instructure.com/api/v1/courses/<course_id>/content_migrations/<migration_id>/selectiv...
This step also worked fine, and gave a list of all the modules in the following fashion:
[
{
"type": "context_modules",
"title": "Recorded Versions of Live Sessions of Finance/Management",
"migration_id": "<migration_id1>",
"property": "copy[context_modules][id_g616c8b73ab33690adf98415d88e6462a]"
},
{
"type": "context_modules",
"title": "Evaluation",
"migration_id": "<migration_id2>",
"property": "copy[context_modules][id_gc2d5f54d2a81b4d03431a17191babb64]"
},
{
"type": "context_modules",
"title": "PS 1 - Diary",
"migration_id": "<migration_id3>",
"property": "copy[context_modules][id_g2fc65977b06059151409dcbb68866c84]"
},
{
"type": "context_modules",
"title": "Bloomberg Mnemonics",
"migration_id": "<migration_id4>",
"property": "copy[context_modules][id_gd5e759ae2437bb70c981d934149f570a]"
}
]
I want to import only the 4th module (Bloomberg Mnemonics). So, I use the update migrations request:
3) Update Migrations:
curl -H 'Authorization: Bearer <Token>' https://canvas.instructure.com/api/v1/courses/<course_id>/content_migrations/<migration_id>; \
--header "Content-Type: application/json" \
--request PUT \
--data '{"copy[context_modules][<migration_id4>]":1}'
The result of the last command is that the entire source course gets copied to the destination course.
Which step did I do wrong?
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.