AnsweredAssumed Answered

How can I create multiple choice questions with the API?

Question asked by Maurizio Tazzer on Sep 27, 2016

Hello.

 

I have been having problems creating multiple choice questions in new quizzes when I take the information out from another course. My program tries to do the following:

  1. GETing the information of the quiz from course 1
  2. POSTing a new quiz in course 2 with the same info as course 1
  3. GETing the information of the questions from course 1. Most of the questions are multiple choice.
  4. For each question, POSTing that info into course 2.

In general everything works fine but when I get to step 4, I get an array to string conversion error. I am using PHP and inside the array I am writing:

     'question[answers]'=>$preg->answers

where $preg is the array I get from each of the questions. All the rest of the info (name, text, type, possible points, etc.) is copied correctly. Do you have any idea what am I doing wrong?

 

Thanks in advance.

Outcomes