Quizzes API
A Quiz object looks like:
{
// the ID of the quiz
id: 5,
// the title of the quiz
title: "Hamlet Act 3 Quiz",
// the HTTP/HTTPS URL to the quiz
html_url: "http://canvas.example.edu/courses/1/quizzes/2",
// a url suitable for loading the quiz in a mobile webview. it will
// persiste the headless session and, for quizzes in public courses, will
// force the user to login
mobile_url: "http://canvas.example.edu/courses/1/quizzes/2?persist_healdess=1&force_user=1",
// the description of the quiz
description: "This is a quiz on Act 3 of Hamlet",
// type of quiz
// possible values: "practice_quiz", "assignment", "graded_survey", "survey"
quiz_type: "assignment",
// the ID of the quiz's assignment group:
assignment_group_id: 3,
// quiz time limit in minutes
time_limit: 5,
// shuffle answers for students?
shuffle_answers: false,
// let students see their quiz responses?
// possible values: null, "always", "until_after_last_attempt"
hide_results: "always",
// show which answers were correct when results are shown?
// only valid if hide_results=null
show_correct_answers: true,
// which quiz score to keep (only if allowed_attempts != 1)
// possible values: "keep_highest", "keep_latest"
scoring_policy: "keep_highest",
// how many times a student can take the quiz
// -1 = unlimited attempts
allowed_attempts: 3,
// show one question at a time?
one_question_at_a_time: false,
// lock questions after answering?
// only valid if one_question_at_a_time=true
cant_go_back: false,
// access code to restrict quiz access
access_code: "2beornot2be",
// IP address or range that quiz access is limited to
ip_filter: "123.123.123.123",
// when the quiz is due
due_at: "2013-01-23T23:59:00-07:00",
// when to lock the quiz
lock_at: null,
// when to unlock the quiz
unlock_at: "2013-01-21T23:59:00-07:00"
}
List quizzes in a course QuizzesApiController#index
GET /api/v1/courses/:course_id/quizzes
Returns the list of Quizzes in this course.
Example Request:
curl https://<canvas>/api/v1/courses/<course_id>/quizzes \
-H 'Authorization: Bearer <token>'
Get a single quiz QuizzesApiController#show
GET /api/v1/courses/:course_id/quizzes/:id
Returns the quiz with the given id.
Returns a QuizCreate a quiz QuizzesApiController#create
POST /api/v1/courses/:course_id/quizzes
Create a new quiz for this course.
Request Parameters:
-
quiz[title]
- String
-
The quiz title.
-
quiz[description]
- String
-
A description of the quiz.
-
quiz[quiz_type]
- "practice_quiz"|"assignment"|"graded_survey"|"survey"
-
The type of quiz.
-
quiz[assignment_group_id]
- Integer
-
The assignment group id to put the assignment in. Defaults to the top assignment group in the course. Only valid if the quiz is graded, i.e. if quiz_type is "assignment" or "graded_survey"
-
quiz[time_limit]
- Integer
-
Time limit to take this quiz, in minutes. Set to null for no time limit. Defaults to null.
-
quiz[shuffle_answers]
- Boolean
-
If true, quiz answers for multiple choice questions will be randomized for each student. Defaults to false.
-
quiz[hide_results]
- null|"always"|"until_after_last_attempt"
-
Dictates whether or not quiz results are hidden from students. If null, students can see their results after any attempt. If "always", students can never see their results. If "until_after_last_attempt", students can only see results after their last attempt. (Only valid if allowed_attempts > 1) Defaults to null.
-
quiz[show_correct_answers]
- Boolean
-
Only valid if hide_results=null If false, hides correct answers from students when quiz results are viewed. Defaults to true.
-
quiz[allowed_attempts]
- Integer
-
Number of times a student is allowed to take a quiz. Set to -1 for unlimited attempts. Defaults to 1.
-
quiz[scoring_policy]
- "keep_highest"|"keep_latest"
-
Required and only valid if allowed_attempts > 1. Scoring policy for a quiz that students can take multiple times. Defaults to "keep_highest".
-
quiz[one_question_at_a_time]
- Boolean
-
If true, shows quiz to student one question at a time. Defaults to false.
-
quiz[cant_go_back]
- Boolean
-
Only valid if one_question_at_a_time=true If true, questions are locked after answering. Defaults to false.
-
quiz[access_code]
- Optional,String
-
Restricts access to the quiz with a password. For no access code restriction, set to null. Defaults to null.
-
quiz[ip_filter]
- Optional,String
-
Restricts access to the quiz to computers in a specified IP range. Filters can be a comma-separated list of addresses, or an address followed by a mask
Examples:
"192.168.217.1" "192.168.217.1/24" "192.168.217.1/255.255.255.0"For no IP filter restriction, set to null. Defaults to null.
-
quiz[due_at]
- Timestamp
-
The day/time the quiz is due. Accepts times in ISO 8601 format, e.g. 2011-10-21T18:48Z.
-
quiz[lock_at]
- Timestamp
-
The day/time the quiz is locked for students. Accepts times in ISO 8601 format, e.g. 2011-10-21T18:48Z.
-
quiz[unlock_at]
- Timestamp
-
The day/time the quiz is unlocked for students. Accepts times in ISO 8601 format, e.g. 2011-10-21T18:48Z.
Edit a quiz QuizzesApiController#update
PUT /api/v1/courses/:course_id/quizzes/:id
Modify an existing quiz. See the documentation for quiz creation.
Additional arguments:
Request Parameters:
-
quiz[notify_of_update]
- Boolean
-
If true, notifies users that the quiz has changed. Defaults to true