Using Content Migrations API to copy courses w/o Announcements?

Jump to solution
Community Participant

I'm looking for a little more clarity on the Content Migrations API. I can usually rely on documentation, but for these enpoints, it's woefully lacking. I've figured out how to do a couple things thanks to a previous post about setting up Content Migrations.

  1. Start a content migration
  2. Include/exclude based on certain categories (e.g., the components listed in the copy JSON array)

Does anybody know if this can be broken down in any additional way? There are no examples of how to use the "select" parameter or how to select as you would in the UI. Does anybody have any idea of how to select specific content without object IDs? I'm hoping to write a script that will:

  1. Start a content migration
  2. Exclude Announcements
  3. Set old start date and end date
  4. Set new start date and end date

I know how to do all except number 2. Is it possible? 

1 Solution
Community Champion


The create a content migration endpoint allows you to do a selective import. One of the values that you can pass for the select hash is announcements. It seems like you might be able to list all the other values you want and then not include announcements.

The select is a hash. When you import a course, Canvas had used the PUT version to modify an existing migration and it sent a copy property instead of select, but it's likely to work the same way.

When I told it to copy content pages and announcements, it looked like this and I would try the same thing with select.

copy: {all_wiki_pages: "1", all_announcements: "1"}

If you want to exclude all announcements, I would first try all_announcements: "0". Based on the comment I left in February 2018, you might just leave out all_announcements to not get it copied.

I have had other issues with selective contents -- the one I'm thinking of is that it doesn't include and set the course grading scheme. So, I've started doing complete course copies and then deleting then things that I don't want to keep. If you find that's an issue, you may want to copy the entire course, then go back after the import is done and delete the announcements.

View solution in original post