Selective Content Migrations in Canvas REST API

Community Explorer

Hi, everyone!

I'm an instructional admin and I've been working with the Canvas API using Python3  -- essentially putting post and get requests in a python wrapper.

I suppose I have two questions here: Firstly, in the past I have been using the copy_course API endpoint as in, 

```payload={'source_course':str(original_course_id),'only[]':'modules'}''+ str(destination_course_id)+ '/course_copy', params=payload, headers = {'Authorization': 'Bearer ' + API_KEY})```

However, this is deprecated and I can't select only one module to import/copy into the course (which is what I really want to do).

My first question is, how in the world do I format my request using the content_migrations endpoint for a course_copy_importer type? I'm guessing it's something like: 

```payload={'migration_type':'course_copy_importer','source_course':str(original_course_id),'select':'modules'}''+ str(destination_course_id)+ '/content_migrations', params=payload, headers = {'Authorization': 'Bearer ' + API_KEY})```

but I’m getting 422s.

My second question is, how should I format my post request when I want to do a selective module import (i.e., I only want to import the first module in a parent course)? I get that the module value should be of type hash, but I'm really scratching my head over how to get the hash, and how to input that into the request. Should I be putting in something like `

``payload= {'source_course':str(original_course_id),'select':1aedffeeds}```

where 1aedffeeds is a placeholder for a hash value? Or should it be a sub-dictionary with ```'module'``` as the key and a hash value?

Again, I'm ultimately looking to simply import one module using the content_migrations endpoint, but any help would be welcomed!

Apologies for being a bit of a newb here.