Found this content helpful? Log in or sign up to leave a like!
422 Unprocessable Entity when attempting to answer a quiz question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am attempting to answer a Quiz Submission Question with the API. I'm first trying to answer a multiple choice question. When a user presses on a button to select an answer, the answer is intended to be submitted. I structured my request to be:
{"quiz_questions":[{"answer":1108,"id":"6"}],"attempt":5,"access_code":null,"validation_token":"0271914e7b879b57228597b866c07ef03fee1a600578a06d65eb4151a8ee8437"}
However, I get a 422.
I have attempted to remove the id field in answer with no luck.
I observed that the web API uses a `backup` endpoint that isn't documented. Is that related at all?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of using "quiz_questions":[{"answer":1108,"id":"6"}]
try "quiz_questions[][id]":6,"quiz_questions[][answer]":1108
I've been successful with this format. Hope it helps you...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to use JSON, then for some of those entries that expect arrays, you may need to use a hash to fake an array by specifying the index of the array as the key of the object. I'm typing this from memory without testing, so I might have something off slightly. If you needed more than one element in the array, you would create a "1" object and a "2" object.
{
"quiz_questions": { "0": {"answer": 1108, "id": 6} },
...
}