API create course export "invalid export_type"

Jump to solution
Community Member


 I'm automating the archiving of our course content for our department using the Canvas REST API. So far I am VERY pleased! The only part that is not working is creating a new course export using the API. 

I use https://canvas.cornell.edu/api/v1/courses/COURSENUM/content_exports with the token authorization header. The data I'm sending is 


and the response I get is 

{"message":"invalid export_type"}

The problem is that I don't know how to format the "export_type" json string and I can't find a working example. I know it's only off by a few characters. I believe that export_type is the only string that I have to send to create a new export.

Does anyone have an example of what the POST json should look like to create a new course export in common cartridge format? 

Every other part of this process is working from the scripts, but I have to create the export manually. Checking the progress, listing the exports, downloading the export file, are all working through the API, just not the initial export creation.

Thank you so much for any help!!



1 Solution
Community Member

After looking through many examples of API calls, I tried sending the data but not as JSON.

curl -d 'export_type=common_cartridge' -X POST https://canvas.cornell.edu/api/v1/courses/<COURSNUM>/content_exports -H "Authorization: Bearer <token>" >new-export.json

Creates the new course export and gives me the JSON I need to find the export. I can also find the export with the list exports function, which gives me a list of all exports just by hitting the above URL with a get and no data besides the token header.

So the output is json but the input is not. More working examples would be better since the docs show this variable but since they don't show an actual call, I couldn't figure out how to format it.


=Rich Humphrey


View solution in original post