Using the curl method to automate import/export of courses

If you experience an error like this one:

I am trying to use `wget` to automate the exporting/importing of a course. It appears to work when I sign in URL but I am not sure and it definitely doesn't work for the import/export. 

Try using the `curl` command instead. They're very similar. Here are the commands to run:

============ one ============ 
# retrieve the csrf token 
$ curl -v -c cookies.txt -b cookies.txt https://studio.openedx.learning.intersystems.com/signin

# no values to override 

============ two ============ 
# perform the actual login 
$ curl -v -c cookies.txt -b cookies.txt -d "email=stuart.peters@intersystems.com&password=mypassword&csrfmiddlewaretoken="$( echo "$(grep csrftoken cookies.txt | sed 's/^.*csrftoken\s*//')" | tr -d '[:space:]')"" --header "Referer: https://studio.openedx.learning.intersystems.com/singinhttps://studio.openedx.learning.intersystems.com/login_post

# the only value that you must override is mypassword for the real password, if another user is using the script will need to override user and password. 

============ three ============ 
# retrieve the course 
curl -v -c cookies.txt -b cookies.txt https://studio.openedx.learning.intersystems.com/export/course-v1:InterSystems+ISC1066+2016_1?_accept=application/x-tgz > course_name.tar.gz 

# here you will need to override the course export URL for each course, and replace course_name.tar.gz with a name for the file

Still need help? Contact Us Contact Us