How to change quiz attributes via API

Jump to solution
fabiocunha
Community Explorer

Hi,

I want to know if is it possible to change some attributes inside a quiz.

In this case, for example, I want to mark the checkbox "Manter os envios anônimos", it must be equivalent to "Keep submissions anonymous" or something like that. Please check the image below:

Canvas Image Example

But I need do to that via API, I use a Python Library from to access Canvas.

GitHub - ucfopen/canvasapi: Python API wrapper for Instructure's Canvas LMS. Easily manage courses, ... 

I use the code below to access the course name, 

canvas = Canvas(API_URL, API_KEY)
course = canvas.get_course(8718)
print(course.name)

but I don't know how to change the attributes(or parameters) inside a quiz.

How can I do that using the Python library?

Regards,

Fabio

0 Likes
1 Solution
fabiocunha
Community Explorer

I was able to resolve the question.

course = canvas.get_course(8718)
print(course.name)
quiz = course.get_quiz(58321)
resultQuiz = quiz.edit( quiz={ 'anonymous_submissions': 'true',
   "due_at": "2020-05-22T23:59:00",
   "lock_at": "2020-05-22T23:59:00"
})

View solution in original post

0 Likes