Using the API call for: Create a single quiz question

Jump to solution
OliverKharasGU
Community Explorer

Hi everyone, I hopefully have a simple question to ask here about this call.

I want to run a creation of quiz questions through a CSV file with this API and I have everything sorted bar how to write the say 4 possible answers to a multiple choice question. I'm using Postman to run the call.

If someone has an example that would be great too 😊

 

*FYI I have attached an image of a test question

 

Thanks again,

0 Likes
1 Solution
James
Community Champion

Answers is an array that contains the responses. For a multiple choice question, you specify the answer_text and answer_weight (0 for incorrect or 100 for correct).

It seems I've answered this question before and that if you are not using JSON, then you need to include the index key. I'm going from memory. I believe my answer at the time might have been to open the developer tools inside the browser and create a question from within Canvas to see what they do and then mimic that behavior.

question[answers][0][answer_text]=12
question[answers][0][answer_weight]=100
question[answers][1][answer_text]=15
question[answers][1][answer_weight]=0
question[answers][2][answer_text]=101
question[answers][2][answer_weight]=0

 

Using JSON makes it easier to organize and understand. Then it's an array of objects as shown in this thread: Quiz question created by api

View solution in original post