New Quiz Items
Welcome to Our New API Docs! This is the new home for all things API (previously at Canvas LMS REST API Documentation).
New Quiz Items API
API for accessing and building items inside a New Quiz. To interact with the quiz itself, see the New Quizzes API.
Glossary:
Quiz Items can be among several types as described here. For now, all types can be retrieved (GET), but some types are restricted to only that functionality.
QuestionItem: question items are the various question types allowed for Quizzes. These question types can be created, updated, retrieved, and deleted with the API. See the Appendix for more details.
StimulusItem: stimulus items are quiz items that define a stimulus that can have associated questions attached to it. For now, stimulus items can only be retrieved with the API. They must be created and updated via the UI.
BankItem: bank items are quiz questions or other items that are part of an item bank. For now, bank items can only be retrieved with the API. They must be created and updated via the UI.
BankEntry: bank entry items allow for a random selection of items from an associated bank to be included in the quiz. For now, bank items can only be retrieved with the API. They must be created and updated via the UI.
A QuizItem object looks like:
// Individual items within a quiz, whether they're questions, stimuli, banked
// content, or question banks.
{
// the ID of the quiz item
"id": "35",
// the position of the item within the quiz. The first item in a quiz is given
// position 1.
"position": 2,
// the number of points available to score on this item
"points_possible": 10.0,
// the type of the item. One of 'Item', 'Stimulus', 'BankEntry', or 'Bank'.
"entry_type": "Item",
// whether the current user can edit the item -- used internally, no need to set
"entry_editable": true,
// the ID of the stimulus that this item is associated with. null if not
// associated with any stimuli.
"stimulus_quiz_entry_id": "3",
// status of the item. one of 'mutable' or 'immutable'. Used internally, no
// need to set
"status": "mutable",
// additional properties for the item (currently only populated by items with a
// BankItem entry)
"properties": null,
// the specific data associated with the quiz item. These items can be either a
// QuestionItem, StimulusItem, BankEntryItem, or BankItem, depending on
// entry_type, and are defined
// separately
"entry": null
}A QuestionItem object looks like:
A StimulusItem object looks like:
A BankEntryItem object looks like:
A BankItem object looks like:
An ItemProperties object looks like:
A QuestionFeedback object looks like:
GET /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Scope: url:GET|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Get details about a single item in a new quiz.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
The id of the assignment associated with the quiz.
item_id
Required integer
The id of the item associated with the quiz.
Example Request:
Returns a QuizItem object.
GET /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items
Scope: url:GET|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items
Get a list of items in a new quiz.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
no description
Example Request:
Returns a list of QuizItem objects.
POST /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items
Scope: url:POST|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items
Create a quiz item in a new quiz. Only QuestionItem types can be created.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
The id of the assignment associated with the quiz.
item[position]
integer
The position of the item within the quiz.
item[points_possible]
number
The number of points available to score on this item. Must be positive.
item[entry_type]
Required string
The type of the item.
Allowed values: Item
item[entry][title]
string
The question title.
item[entry][item_body]
Required string
The question stem (rich content).
item[entry][calculator_type]
string
Type of calculator the user will have access to during the question.
Allowed values: none, basic, scientific
item[entry][feedback][neutral]
string
General feedback to show regardless of answer (rich content).
item[entry][feedback][correct]
string
Feedback to show if the question is answered correctly (rich content).
item[entry][feedback][incorrect]
string
Feedback to show if the question is answered incorrectly (rich content).
item[entry][interaction_type_slug]
Required string
The type of question. One of ‘multi-answer’, ‘matching’, ‘categorization’, ‘file-upload’, ‘formula’, ‘ordering’, ‘rich-fill-blank’, ‘hot-spot’, ‘choice’, ‘numeric’, ‘true-false’, or ‘essay’. See Appendix: Question Types for more info about each type.
item[entry][interaction_data]
Required Object
An object that contains the question data. See Appendix: Question Types for more info about this field.
item[entry][properties]
Object
An object that contains additional properties for some question types. See Appendix: Question Types for more info about this field.
item[entry][scoring_data]
Required Object
An object that describes how to score the question. See Appendix: Question Types for more info about this field.
item[entry][answer_feedback]
Object
Feedback provided for each answer (rich content, only available on ‘choice’ question types).
item[entry][scoring_algorithm]
Required string
The algorithm used to score the question. See Appendix: Question Types for more info about this field.
Example Request:
Returns a QuizItem object.
PATCH /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Scope: url:PATCH|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Update a single quiz item in a new quiz. Only QuestionItem types can be updated.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
The id of the assignment associated with the quiz.
item_id
Required integer
The id of the item associated with the quiz.
item[position]
integer
The position of the item within the quiz.
item[points_possible]
number
The number of points available to score on this item. Must be positive.
item[entry_type]
string
The type of the item.
Allowed values: Item
item[entry][title]
string
The question title.
item[entry][item_body]
string
The question stem (rich content).
item[entry][calculator_type]
string
Type of calculator the user will have access to during the question.
Allowed values: none, basic, scientific
item[entry][feedback][neutral]
string
General feedback to show regardless of answer (rich content).
item[entry][feedback][correct]
string
Feedback to show if the question is answered correctly (rich content).
item[entry][feedback][incorrect]
string
Feedback to show if the question is answered incorrectly (rich content).
item[entry][interaction_type_slug]
string
The type of question. One of ‘multi-answer’, ‘matching’, ‘categorization’, ‘file-upload’, ‘formula’, ‘ordering’, ‘rich-fill-blank’, ‘hot-spot’, ‘choice’, ‘numeric’, ‘true-false’, or ‘essay’. See Appendix: Question Types for more info about each type.
item[entry][interaction_data]
Object
An object that contains the question data. See Appendix: Question Types for more info about this field.
item[entry][properties]
Object
An object that contains additional properties for some question types. See Appendix: Question Types for more info about this field.
item[entry][scoring_data]
Object
An object that describes how to score the question. See Appendix: Question Types for more info about this field.
item[entry][answer_feedback]
Object
Feedback provided for each answer (rich content, only available on ‘choice’ question types).
item[entry][scoring_algorithm]
string
The algorithm used to score the question. See Appendix: Question Types for more info about this field.
Example Request:
Returns a QuizItem object.
DELETE /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Scope: url:DELETE|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/:item_id
Delete a single quiz item in a new quiz.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
The id of the assignment associated with the quiz.
item_id
Required integer
The id of the item associated with the quiz.
Example Request:
Returns a QuizItem object.
GET /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/media_upload_url
Scope: url:GET|/api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/media_upload_url
Get a url for uploading media for use in hot-spot question types. See the hot-spot question type in the Appendix: Question Types for more details about using this endpoint.
Request Parameters:
course_id
Required integer
no description
assignment_id
Required integer
no description
Example Request:
Example Response:
Appendixes
Appendix: Question Types
The quiz items API retrieves and manages the quiz items associated with a quiz such as question types, stimulus items, and item bank entries. This supplemental data describes the specific quiz item data for question types.
Some data creation for quiz items must include UUID values. These UUIDs must be generated properly when creating question types that require them. An online generator, such as https://www.uuidgenerator.net/, can be used to generate one or more UUIDs. A Version 4 UUID is recommended.
A complete example of a JSON request body for a choice question type is provided below. More details about each of the 13 question types are provided afterwards.
Example request body for choice question:
Details about each question type:
True/False
Interaction Data
Scoring Data
Categorization
Interaction Data
Categorization Interaction Data includes categories, distractors, and a category order for the categories
Properties
Scoring Data
Multiple Answer
Multiple Answer question types provide two or more selections with one or more correct answers.
Interaction Data
Properties
Scoring Data
Matching
Interaction Data
Properties
Scoring Data
File Upload
Interaction Data
Properties
Scoring Data
Scoring data is essentially nil with this data structure
Formula
Interaction Data
Properties
Scoring Data
Ordering
Interaction Data
Properties
Scoring Data
Rich Fill In The Blank
Interaction Data
Properties
Scoring Data
Hot Spot
To create a hotspot question, first upload the image to the url obtained with the media_upload_url endpoint. Then create the question item, including the image's url in the item's interaction_data. The requests look like this:
GET /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items/media_upload_url. This returns a presigned url for uploading the image.PUT <media_upload_url>with the image included in the request as a data attribute. For example, in cURL:POST /api/quiz/v1/courses/:course_id/quizzes/:assignment_id/items, including the unsigned media_upload_url in the request's interaction_data param, like this:
Interaction Data
Properties
Scoring Data
Multiple Choice
Interaction Data
Properties
Scoring Data
Scoring data when Vary Points by Answer is true
Scoring data when Vary Points by Answer is false
Answer Feedback
Numeric
Interaction Data
Properties
Scoring Data
Essay
Interaction Data
Properties
Scoring Data
Fill In The Blank (deprecated; only create rich-fill-blank questions)
This data is similar to rich fill in the blank. It is deprecated, so this is only provided for reference. All data types are not represented here.
Interaction Data
Properties
Scoring Data
This documentation is generated directly from the Canvas LMS source code, available on Github.
Last updated
Was this helpful?