422 error on Quiz submission post.

Jump to solution
jnwilson
Community Member

Sorry for what may be just a typical newb question.
I'm trying to write a python script to upload quiz scores.
It yields a 422 error.
I can do a get on the same URL, so the quiz submission being modified actually exists.

An appropriately sanitized curl version of the request is the following:

curl  https://mysite.com/api/v1/courses/#######/quizzes/######/submissions/######## \
     -d '{"quiz_submissions" : [{"attempt": 2, "fudge_points": 0, "questions": {"1": {"score": 7.0, "comment": "Category,Pts,Deductions;Report Clarity,1.0,1.0;Key 1,1.0,;Key 1 method,2.0,2.0;Key 2,1.0,;Key 2 method,2.0,;,,;Score,,7.0"}}}]}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <MyTokenValueHere>'

The text of the response includes this message (which seems to be less than accurate or relevant):

There was a problem with your last request.  You may have tried to perform an action after a long period of inactivity.  If that&#39;s the case, try going back, reloading the page you were working on, and resubmitting.  If not, please let us know what you were doing when the error happened.

 

If you see an obvious problem, I will sing the praises of your name.



0 Likes
2 Solutions
jnwilson
Community Member
Author

And, yes, I am the teacher of the class, using one of my access tokens.

 

View solution in original post

0 Likes
jnwilson
Community Member
Author

I was doing a POST rather than PUT. PUT worked fine.

View solution in original post

0 Likes