Instructure Developer Documentation Portal
Community
  • Introduction
  • Services
    • Elevate Standards Alignment - AB Connect API
      • Introduction
        • Authentication
        • Addressing Object Properties
        • Requesting Additional Properties in the Response
        • Filtering Using ODATA Like Statements
        • Sorting
        • Facets
        • Paging Data
        • Call Throttling
        • Working with Related Object
        • Error Responses
        • Character Set Support
        • How To Articles, Recommendations and Suggestions
        • Examples
        • Using AB Connect's Embeddable Widgets
      • Reference
        • Standards
        • Standard Collections
        • Events
        • Topics
        • Concepts
        • Assets
        • Asset Definitions
        • Asset Collections
        • Managing and Predicting Relationships
        • Providers
    • Canvas LMS
      • Basics
        • GraphQL
        • API Change Log
        • SIS IDs
        • Pagination
        • Throttling
        • Compound Documents
        • File Uploads
        • API Endpoint Attributes
        • Masquerading
      • OAuth2
        • OAuth2 Overview
        • OAuth2 Endpoints
        • Developer Keys
      • Resources
        • Access Tokens
        • Account Calendars
        • Account Domain Lookups
        • Account Notifications
        • Account Reports
        • Accounts
        • Accounts (LTI)
        • Admins
        • Analytics
        • Announcement External Feeds
        • Announcements
        • API Token Scopes
        • Appointment Groups
        • Assignment Extensions
        • Assignment Groups
        • Assignments
        • Authentication Providers
        • Authentications Log
        • Blackout Dates
        • BlockEditorTemplate
        • Blueprint Courses
        • Bookmarks
        • Brand Configs
        • Calendar Events
        • Collaborations
        • CommMessages
        • Communication Channels
        • Conferences
        • Content Exports
        • Content Migrations
        • Content Security Policy Settings
        • Content Shares
        • Conversations
        • Course Audit log
        • Course Pace
        • Course Quiz Extensions
        • Course Reports
        • Courses
        • Custom Gradebook Columns
        • Developer Key Account Bindings
        • Developer Keys
        • Discussion Topics
        • Enrollment Terms
        • Enrollments
        • ePortfolios
        • ePub Exports
        • Error Reports
        • External Tools
        • Favorites
        • Feature Flags
        • Files
        • Grade Change Log
        • Gradebook History
        • Grading Period Sets
        • Grading Periods
        • Grading Standards
        • Group Categories
        • Groups
        • History
        • InstAccess tokens
        • JWTs
        • Late Policy
        • Learning Object Dates
        • Line Items
        • LiveAssessments
        • Logins
        • LTI Launch Definitions
        • LTI Registrations
        • LTI Resource Links
        • Media Objects
        • Moderated Grading
        • Modules
        • Names and Role
        • New Quiz Items
        • New Quizzes
        • New Quizzes Accommodations
        • New Quizzes Reports
        • Notification Preferences
        • Originality Reports
        • Outcome Groups
        • Outcome Imports
        • Outcome Results
        • Outcomes
        • Pages
        • Peer Reviews
        • Planner
        • Poll Sessions
        • PollChoices
        • Polls
        • PollSubmissions
        • Proficiency Ratings
        • Progress
        • Public JWK
        • Quiz Assignment Overrides
        • Quiz Extensions
        • Quiz IP Filters
        • Quiz Question Groups
        • Quiz Questions
        • Quiz Reports
        • Quiz Statistics
        • Quiz Submission Events
        • Quiz Submission Files
        • Quiz Submission Questions
        • Quiz Submission User List
        • Quiz Submissions
        • Quizzes
        • Result
        • Roles
        • Rubrics
        • Sandboxes
        • Score
        • Search
        • Sections
        • Services
        • Shared Brand Configs
        • SIS Import Errors
        • SIS Imports
        • SIS Integration
        • Smart Search
        • Submission Comments
        • Submissions
        • Tabs
        • Temporary Enrollment Pairings
        • User Observees
        • Users
        • What If Grades
      • Outcomes
        • Outcomes CSV Format
      • Group Categories
        • Group Categories CSV Format
      • SIS
        • SIS CSV Format
      • External Tools
        • LTI
          • Introduction
          • Registration
          • Launch Overview
          • Configuring
          • Variable Substitutions
          • Deep Linking
          • Grading
          • Provisioning
          • PostMessage
          • Platform Notification Service
          • Placements
            • Placements Overview
            • Navigation
            • Homework Submission
            • Editor Button
            • Migration Selection
            • Link Selection (Modules)
            • Assignment Selection
            • Collaborations
        • xAPI
        • Canvas Roles
        • Plagiarism Detection Platform
          • Overview
          • Plagiarism Detection Platform Assignments
          • Plagiarism Detection Platform Users
          • Plagiarism Detection Submissions
          • Webhooks Subscriptions for Plagiarism Platform
          • JWT Access Tokens
      • Data Services
        • Live Events
          • Overview
            • Introduction
            • Setup
            • Caliper
            • Metadata
          • Event Format
            • Canvas
              • Account
              • Asset
              • Assignment
              • Attachment
              • Content
              • Conversation
              • Course
              • Discussion
              • Enrollment
              • Grade
              • Group
              • Learning
              • Logged
              • Module
              • Outcome
              • Outcomes
              • Plagiarism
              • Quiz
              • Rubric
              • Sis
              • Submission
              • Syllabus
              • User
              • Wiki
            • Caliper IMS 1.1
              • Assessment
              • Basic
              • Forum
              • Grading
              • Navigation Events
              • Session
    • Catalog
      • APIs
        • Analytics
        • Bulk Enrollments
        • Catalogs
        • Certificates
        • Completed Certificates
        • Courses
        • Email Domain Set
        • Enrollments
        • Orders
        • Programs
        • Progresses
        • Tags
        • User Registrations
        • Users
        • Waitlist Applicants
    • Credentials
      • Getting Started
      • Authentication
        • Password-Based Authentication
        • Authorization Code-Based Authentication
      • Pagination
      • APIs
        • Assertions
        • Backpack
        • Badgeclasses
        • Issuers
        • Organizations
        • Users
      • Release Notes
    • Data Access Platform
      • Key Concepts
      • Data Formats
      • Rate Limits & Policies
      • Datasets
        • Namespaces
          • canvas
            • canvas types
          • canvas_logs
          • catalog
        • Additional Notes
        • Entity Relationship Diagram
      • Query API
        • Authentication
        • Reference
      • Command Line (DAP CLI)
        • Getting Started
        • Secure Connection
        • Reference
          • dap snapshot
          • dap incremental
          • dap list
          • dap schema
          • dap initdb
          • dap syncdb
          • dap dropdb
      • Client Library
        • Examples
        • Reference
      • Release Notes
      • Status
    • DataSync
      • Interop API
      • Interop Data API
      • Grades Exchange API
      • OneRoster API
      • Platform API
    • Instructure Media
      • API Reference
        • Captions
        • Collection
        • Courses
        • Group
        • Insights
        • Media
        • Media Upload
        • Ping
        • Professional Captioning
        • Tags
        • Transfer Media
        • User
    • Quizzes
      • Quiz API
Powered by GitBook

Copyright © 2008-2024 Instructure, Inc. All rights reserved. Various trademarks held by their respective owners.

On this page
  • Get all quiz submission questions.
  • Answering questions
  • Get a formatted student numerical answer.
  • Flagging a question.
  • Unflagging a question.
  • Appendixes
  • Appendix: Question Answer Formats

Was this helpful?

  1. Services
  2. Canvas LMS
  3. Resources

Quiz Submission Questions

PreviousQuiz Submission FilesNextQuiz Submission User List

Last updated 2 months ago

Was this helpful?

API for answering and flagging questions in a quiz-taking session.

A QuizSubmissionQuestion object looks like:

{
  // The ID of the QuizQuestion this answer is for.
  "id": 1,
  // Whether this question is flagged.
  "flagged": true,
  // The provided answer (if any) for this question. The format of this parameter
  // depends on the type of the question, see the Appendix for more information.
  "answer": null,
  // The possible answers for this question when those possible answers are
  // necessary.  The presence of this parameter is dependent on permissions.
  "answers": null
}

GET /api/v1/quiz_submissions/:quiz_submission_id/questions

Scope: url:GET|/api/v1/quiz_submissions/:quiz_submission_id/questions

Get a list of all the question records for this quiz submission.

200 OK response code is returned if the request was successful.

Request Parameters:

Parameter
Type
Description

include[]

string

Associations to include with the quiz submission question.

Allowed values: quiz_question

Example Response:

{
  "quiz_submission_questions": [QuizSubmissionQuestion]
}

POST /api/v1/quiz_submissions/:quiz_submission_id/questions

Scope: url:POST|/api/v1/quiz_submissions/:quiz_submission_id/questions

Provide or update an answer to one or more QuizQuestions.

Request Parameters:

Parameter
Type
Description

attempt

Required integer

The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified.

validation_token

Required string

The unique validation token you received when the Quiz Submission was created.

access_code

string

Access code for the Quiz, if any.

quiz_questions[]

QuizSubmissionQuestion

Set of question IDs and the answer value.

Example Request:

{
  "attempt": 1,
  "validation_token": "YOUR_VALIDATION_TOKEN",
  "access_code": null,
  "quiz_questions": [{
    "id": "1",
    "answer": "Hello World!"
  }, {
    "id": "2",
    "answer": 42.0
  }]
}

GET /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer

Scope: url:GET|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer

Matches the intended behavior of the UI when a numerical answer is entered and returns the resulting formatted number

Request Parameters:

Parameter
Type
Description

answer

Required Numeric

no description

Example Response:

{
  "formatted_answer": 12.1234
}

PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag

Scope: url:PUT|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag

Set a flag on a quiz question to indicate that you want to return to it later.

Request Parameters:

Parameter
Type
Description

attempt

Required integer

The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified.

validation_token

Required string

The unique validation token you received when the Quiz Submission was created.

access_code

string

Access code for the Quiz, if any.

Example Request:

{
  "attempt": 1,
  "validation_token": "YOUR_VALIDATION_TOKEN",
  "access_code": null
}

PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag

Scope: url:PUT|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag

Remove the flag that you previously set on a quiz question after you’ve returned to it.

Request Parameters:

Parameter
Type
Description

attempt

Required integer

The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified.

validation_token

Required string

The unique validation token you received when the Quiz Submission was created.

access_code

string

Access code for the Quiz, if any.

Example Request:

{
  "attempt": 1,
  "validation_token": "YOUR_VALIDATION_TOKEN",
  "access_code": null
}

Appendixes

Appendix: Question Answer Formats

.appendix_entry div.syntaxhighlighter table { width: 100%; }

.appendix_entry h4 { color: green; }

Essay Questions

  • Question parametric type: essay_question

  • Parameter type: Text

  • Parameter synopsis: { "answer": "Answer text." }

Example request

{
  "answer": "<h2>My essay</h2>\n\n<p>This is a long article.</p>"
}

Possible errors

HTTP RC
Error Message
Cause

400 Bad Request

Text is too long.

The answer text is larger than the allowed limit of 16 kilobytes.

Fill In Multiple Blanks Questions

  • Question parametric type: fill_in_multiple_blanks_question

  • Parameter type: Hash{String => String}

  • Parameter synopsis: { "answer": { "variable": "Answer string." } }

Example request

Given that the question accepts answers to two variables, color1 and color2:

{
  "answer": {
    "color1": "red",
    "color2": "green"
  }
}

Possible errors

HTTP RC
Error Message
Cause

400 Bad Request

Unknown variable 'var'.

The answer map contains a variable that is not accepted by the question.

400 Bad Request

Text is too long.

The answer text is larger than the allowed limit of 16 kilobytes.

Fill In The Blank Questions

  • Question parametric type: short_answer_question

  • Parameter type: String

  • Parameter synopsis: { "answer": "Some sentence." }

Example request

{
  "answer": "Hello World!"
}

Possible errors

Formula Questions

  • Question parametric type: calculated_question

  • Parameter type: Decimal

  • Parameter synopsis: { "answer": decimal } where decimal is either a rational number, or a literal version of it (String)

Example request

With an exponent:

{
  "answer": 2.3e-6
}

With a string for a number:

{
  "answer": "13.4"
}

Possible errors

HTTP RC
Error Message
Cause

400 Bad Request

Parameter must be a valid decimal.

The specified value could not be processed as a decimal.

Matching Questions

  • Question parametric type: matching_question

  • Parameter type: Array<Hash>

  • Parameter synopsis: { "answer": [{ "answer_id": id, "match_id": id }] } where the IDs must identify answers and matches accepted by the question.

Example request

Given that the question accepts 3 answers with IDs [ 3, 6, 9 ] and 6 matches with IDs: [ 10, 11, 12, 13, 14, 15 ]:

{
  "answer": [{
    "answer_id": 6,
    "match_id": 10
  }, {
    "answer_id": 3,
    "match_id": 14
  }]
}

The above request:

  • pairs answer#6 with match#10

  • pairs answer#3 with match#14

  • leaves answer#9 un-matched

Possible errors

<tr>
  <td>400 Bad Request</td>
  <td><code>Answer entry must be of type Hash, got '...'.</code></td>
  <td>One of the entries of the match-pairings set is not a valid hash.</td>
</tr>

<tr>
  <td>400 Bad Request</td>
  <td><code>Missing parameter 'answer_id'.</code></td>
  <td>One of the entries of the match-pairings does not specify an <code>answer_id</code>.</td>
</tr>

<tr>
  <td>400 Bad Request</td>
  <td><code>Missing parameter 'match_id'.</code></td>
  <td>One of the entries of the match-pairings does not specify an <code>match_id</code>.</td>
</tr>


<tr>
  <td>400 Bad Request</td>
  <td><code>Parameter must be of type Integer.</code></td>
  <td>
    One of the specified <code>answer_id</code> or <code>match_id</code>
    is not an integer.
  </td>
</tr>

<tr>
  <td>400 Bad Request</td>
  <td><code>Unknown answer '123'.</code></td>
  <td>An <code>answer_id</code> you supplied does not identify a valid answer
  for that question.</td>
</tr>

<tr>
  <td>400 Bad Request</td>
  <td><code>Unknown match '123'.</code></td>
  <td>A <code>match_id</code> you supplied does not identify a valid match
  for that question.</td>
</tr>
HTTP RC
Error Message
Cause

400 Bad Request

Answer must be of type Array.

The match-pairings set you supplied is not an array.

Multiple Choice Questions

  • Question parametric type: multiple_choice_question

  • Parameter type: Integer

  • Parameter synopsis: { "answer": answer_id } where answer_id is an ID of one of the question's answers.

Example request

Given an answer with an ID of 5:

{
  "answer": 5
}

Possible errors

HTTP RC
Error Message
Cause

400 Bad Request

Parameter must be of type Integer.

The specified `answer_id` is not an integer.

400 Bad Request

Unknown answer '123'

The specified `answer_id` is not a valid answer.

Multiple Dropdowns Questions

  • Question parametric type: multiple_dropdowns_question

  • Parameter type: Hash{String => Integer}

  • Parameter synopsis: { "answer": { "variable": answer_id } } where the keys are variables accepted by the question, and their values are IDs of answers provided by the question.

Example request

Given that the question accepts 3 answers to a variable named color with the ids [ 3, 6, 9 ]:

{
  "answer": {
    "color": 6
  }
}

Possible errors

HTTP RC
Error Message
Cause

400 Bad Request

Unknown variable 'var'.

The answer map you supplied contains a variable that is not accepted by the question.

400 Bad Request

Unknown answer '123'.

An answer_id you supplied does not identify a valid answer for that question.

Multiple Answers Questions

  • Question parametric type: multiple_answers_question

  • Parameter type: Array<Integer>

  • Parameter synopsis: { "answer": [ answer_id ] } where the array items are IDs of answers accepted by the question.

Example request

Given that the question accepts 3 answers with the ids [ 3, 6, 9 ] and we want to select the answers 3 and 6:

{
  "answer": [ 3, 6 ]
}

Possible errors

<tr>
  <td>400 Bad Request</td>
  <td><code>Unknown answer '123'.</code></td>
  <td>An answer ID you supplied in the selection set does not identify a
    valid answer for that question.</td>
</tr>
HTTP RC
Error Message
Cause

400 Bad Request

Selection must be of type Array.

The selection set you supplied is not an array.

400 Bad Request

Parameter must be of type Integer.

One of the answer IDs you supplied is not a valid ID.

Numerical Questions

  • Question parametric type: numerical_question

True/False Questions

  • Question parametric type: true_false_question


See for the accepted answer formats for each question type.

Returns a list of objects.

Similar to the errors produced by .

This is similar to .

The rest is similar to .

This documentation is generated directly from the Canvas LMS source code, available .

Quizzes::QuizSubmissionQuestionsController#answer
Quizzes::QuizSubmissionQuestionsController#formatted_answer
Quizzes::QuizSubmissionQuestionsController#flag
Quizzes::QuizSubmissionQuestionsController#unflag
on Github
Quizzes::QuizSubmissionQuestionsController#index
Get all quiz submission questions.
Answering questions
QuizSubmissionQuestion
Get a formatted student numerical answer.
Flagging a question.
Unflagging a question.
Essay Questions
Formula Questions
Multiple Choice questions
Appendix: Question Answer Formats