@MattHanes
a simple script we wrote to mass publish courses looks like this:
# Canvas Course Publishing Script, written by Luke Levesque - Liberty University
# Written for use with python 2.7 and 'requests' package - http://docs.python-requests.org/en/
import requests
token = '<token goes here>'
url = 'https://canvas.instructure.com'
account_id = '<canvas account number>'
header = {'Authorization': 'Bearer ' + '%s' % token}
def publishCourses(courselist):
for id in courselist:
payload = {'course_ids[]': id, 'event': 'offer' }
r = requests.put(url + '/api/v1/accounts/' + account_id + '/courses/' + str(id), params=payload, headers = header )
data = r.json() #json response of the PUT request
return data
if __name__ == "__main__":
user_input = raw_input("Please enter the Course IDs to publish: ") #accepts a space separated list of canvas course ids
courselist = map(int, s.split()) #splits the values at each space and appends it to this list
publishCourses(courselist)
Let me know if you have questions or a specific function in mind, we've done quite a lot in python.