API Update of Quiz Question Points removes some other properties?

BrianHall76
Community Explorer

Hi all -

I wrote a Python script to update the Quiz Point value on all questions in a given Classic quiz.  It does a simple loop through the questions IDs with

PUT /api/v1/courses/:course_id/quizzes/:quiz_id/questions/:id

 and a payload of just {'question[points_possible]' : floatPointValue}

The script does what I want for the points, but when I ran it against a Quiz I had just laboriously finished copy/pasting the Answer comments into 50 4-option multiple choice questions, it wiped them all out.

One thing that I have noticed when I've run the script is that after it runs I have to Edit and Save the quiz for the Total Points to update.  Just refreshing the Quiz page won't pick up the change.  I did confirm that it is the run of the script, not the subsequent Edit/Save that wipes the questions comments out.  They are gone when I Edit the quiz after the script run.

I also did a test where I modified the formatting of the Question text (added bold and italics), updated the Questions, and saved the quiz.  Then ran the script.  It reset the formatting also.

I'd prefer not to have to pull the existing question comments into a variable just to put it back into the Payload since I'm not touching that.  And I'm concerned that there's just something generally wrong with my approach and I could be losing other saved changes.

Any thoughts on what I'm doing wrong in the call that is wiping out other Question details when I'm just trying to update the Points?

Labels (2)
0 Likes