@chriscas , thanks for the prompt reply! I want to focus on the format of the hash that the API expects before I throw all the code your way. To maybe help clarify and avoid having you compare the link in the OP to my code, here's the documented format of a hash:
{
"quiz_submissions": [{
"attempt": 1,
"fudge_points": -2.4,
"questions": {
"1": {
"score": 2.5,
"comment": "This can't be right, but I'll let it pass this one time."
},
"2": {
"score": 0,
"comment": "Good thinking. Almost!"
}
}
}]
}And here is my overall hash from the OP, but combined together to remove the variable obfuscation.
{
'quiz_submissions': [{
'attempt': 1,
'fudge_points': 0,
'questions': {
'229417081': {'score': 10, 'comment': ''},
'229417071': {'score': 10, 'comment': ''},
'229417074': {'score': 10, 'comment': ''},
'229417023': {'score': 10, 'comment': ''},
'229415416': {'score': 30, 'comment': ''},
'229417041': {'score': 30, 'comment': ''}
}
}]
}As Mr Bowman asked in his question above, the single quotes are a product of the VSCode debugger, so I can't imagine that being a problem. As far as I can tell, this should work per the API documentation. I've tried using both the question IDs as shown above and numbering them 1-6, but neither work.
As for your question on Canvas API vs Live API, I was using Live API as a method to debug. I gave it my course_id, quiz_id, and submission ID to verify I had all the right values and am indeed able to get the correct data back. When I try that with the PUT for "update student scores and comments" with the above hash, it gives me the message "missing required key :quiz_submissions"
Does that help? If not, I can share more of the relevant code.