Vous êtes sur la page 1sur 2

Josh N (13/07/2020, 11:57:02): Hi Mladenko! Welcome back. How can I help you?

Me (13/07/2020, 11:57:12): Hi Josh


Me (13/07/2020, 11:58:04): Sorry my poor internet connection dropped me out of the
chat I had with Kevin before
Me (13/07/2020, 11:58:16): Do I need to repeat everything?
Josh N (13/07/2020, 11:59:43): Let me check and see real quick. One moment please.
Josh N (13/07/2020, 12:05:26): Here's what I got from your last chat with him:

"I'm trying to use API to automate quiz question creation, especially offered
answers. I have used API Live webpage to execute most "GET" commands but when it
comes to creating new questions or editing existing, it always fails. In
particular, I'm struggling with multiple dropdown questions."

Doing this is returning a 400 Bad Request error, right?


Me (13/07/2020, 12:05:35): that is right
Me (13/07/2020, 12:05:49): and I shared a code/command
Josh N (13/07/2020, 12:06:01): {
"quiz_id": 342455,
"quiz_group_id": null,
"assessment_question_id": 4666337,
"position": null,
"question_name": "Question",
"question_type": "multiple_dropdowns_question",
"question_text": "<p>[1]</p>\n<p>[2]</p>",
"points_possible": 0,
"correct_comments": "",
"incorrect_comments": "",
"neutral_comments": "",
"correct_comments_html": "",
"incorrect_comments_html": "",
"neutral_comments_html": "",
"answers": [
{
"text": "text for 1",
"comments": "",
"comments_html": "",
"weight": 100,
"blank_id": "1"
}
( 53m 1s ) Mladenko: ],
"variables": null,
"formulas": null,
"answer_tolerance": null,
"formula_decimal_places": null,
"matches": null,
"matching_answer_incorrect_matches": null
}
Josh N (13/07/2020, 12:06:02): This, right?
Josh N (13/07/2020, 12:06:54): And the last question that Kevin asked was "What is
the specific API call you're making with your code?"
Me (13/07/2020, 12:11:34): you there?
Josh N (13/07/2020, 12:11:49): I am, yes. Did you not get the last few messages I
sent you?
Me (13/07/2020, 12:12:16): yes... well if i POST that it bounces back with the
error
Me (13/07/2020, 12:13:13): I can create a question without answers. The moment I
try to put something for answers, it fails
for example if I go https://rmit.instructure.com/doc/api/live and do that, it sends
me the 500 error
if I do it via Adv REST Client it is the 400 error
Josh N (13/07/2020, 12:14:27): Let me check and see why that might be.
Me (13/07/2020, 12:16:29): ok
Josh N (13/07/2020, 12:20:46): Just for my understanding, you're trying to script
it to more automate question creation, right?

Why not use the UI?


Me (13/07/2020, 12:21:55): well entering 200 questions each with 10 options
manually would hurt like hell :)
Josh N (13/07/2020, 12:24:15): I see. Sorry, let me check a few more things over
Josh N (13/07/2020, 12:32:12): So, we will need to see your entire call. What you
provided earlier was a script, but we need to see the specific call that's giving
you the error message.
Josh N (13/07/2020, 12:32:44): The call would have the info like question[answers]=
and then answers they are inputting. and question[question_name]= and the name etc
as in the doc here:
https://canvas.instructure.com/doc/api/quiz_questions.html#method.quizzes/quiz_ques
tions.create
Me (13/07/2020, 12:33:15): do you have an example to share?
Me (13/07/2020, 12:34:58): I had a look at the documentation and it is not helping
Me (13/07/2020, 12:35:37): what I omitted from the script before is this:
Me (13/07/2020, 12:35:39): POST /api/v1/courses/64729/quizzes/342455/questions?
access_token= HTTP/1.1
Host: rmit.instructure.com:443
accept: application/json
content-type: application/json
Me (13/07/2020, 12:36:21): if I do this via Adv REST Client, I get the 400 error
Me (13/07/2020, 12:36:52): if I do via the API live page, then it is the 500 error
Me (13/07/2020, 12:37:42): Do you have a dummy code that I can use to test? I could
have been doing this wrong all along.
Josh N (13/07/2020, 12:37:48): Try this

/api/v1/courses/:course_id/quizzes/:quiz_id/questions?
question[question_name]=question12&question[answers]=[answer]
Me (13/07/2020, 12:38:28): by the way, I'm not an admin but rather a user (teaching
staff)
Josh N (13/07/2020, 12:39:35): I see. Then you might need to reach out to your
admins to have them help you with getting it setup. What I provided you though
should help with your call
Josh N (13/07/2020, 12:40:09): We don't provide support on making scripts here, I'm
afraid. The call information I provided should do the trick for you.
Me (13/07/2020, 12:41:21): ok. Thank you. I'll see what I can make out of this.
Best regards
Josh N (13/07/2020, 12:42:02): Sounds good. Was there anything else I could assist
you with at this time?
Me (13/07/2020, 12:42:19): that is all. thanks
Josh N (13/07/2020, 12:42:48): You're welcome, I hope you have a great rest of your
week :)
Me (13/07/2020, 12:43:02): you too. bye

Vous aimerez peut-être aussi