EDIT: Updated the post to reflect some of the things I learned in comments and feedback to make this more clear.
Good day! First time posting here, so here's to hoping I can make this easy to understand. I'm an instructor with a passion to automate manual tasks.
Foregoing the fact that I'm using the Python canvasapi, I'm struggling with the Live API (which will later inform how I use my Python API).
The Canvas LMS API provides the following example 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!"
}
}
}]
}
The link to that source is here:
https://canvas.instructure.com/doc/api/quiz_submissions.html#method.quizzes/quiz_submissions_api.update
Here's the hash my Python code produces:
{
'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': ''}
}
}]
}We've already established that the question IDs are the correct value to use rather than 1/2/3/etc, and the single/double quotes are not the issue. The course_id, quiz_id, and submission ID I give to Live API are all correct, as they work for the GETs. It's this one PUT that is rejecting my hash with the following error:
{ "status": "bad_request", "message": "missing required key :quiz_submissions" }What am I doing wrong with my hash in Live API?