Multiple module prerequisites using POST with python

kelleyk2
Community Explorer

I'm working on a python script that will automatically create the modules for my canvas course. I'm using the "requests" library in python. Everything seems to be working well, except for the modules prerequisites. For modules with only one prerequisite, it works as expected. For modules with multiple prerequisites, only the first prerequisite seems to go through.

 

The API documentation states that the parameter to pass is module[module_prerequisite_ids][] with type string.

 

The problem is that the documentation says nothing about the FORMAT of the string. I've tried all of the following string formats, where 1234567 and 1234568 represent the module ids for the prerequisites:

"1234567 1234568"

"1234567, 1234568"

"[1234567 1234568]"

"[1234567, 1234568]"

Nothing seems to work. In the first two instances, only the first prerequisite is being applied. In the two cases with the square brackets, none of the prerequisites are being applied.

Any insight on the appropriate syntax for the string would be greatly appreciated.

module[prerequisite_module_ids][]   string

IDs of Modules that must be completed before this one is unlocked Prerequisite modules must precede this module (i.e. have a lower position value), otherwise they will be ignored

0 Likes