/submit-quiz

Submit all answers for a quiz, saving the data and grading the submission.

Input Parameters

Parameter
Type
Description

quizId

String

The unique identifier for the quiz.

primaryKey

String

The primary key for the student. Optional: If no PK then the submission will not be saved. Request will just return the graded submission.

studentInput

Array of Strings or Numbers

The answers submitted by the student. String for free form questions.

Number for index of multiple choice questions.

Example Request

// Example to submit a quiz
fetch('https://api.arlinear.com/functions/v1/submit-quiz', {
    method: 'POST',
    headers: {
        'Authorization': '<Your API Key>',
    },
    body: JSON.stringify({
        'quizId': 'ba777045-7033-4701-b17b-da9e90dcd41e',
        'primaryKey': 'emily@school.com',
        'studentInput': [0, "the mitochondria is the powerhouse of the cell", ...] // see note below
    })
})

/*
  --- for studentInput ---
  
      for short answer questions: pass in a string for student input (i.e "the mitochondria is the powerhouse of the cell")
      
      for multiple choice questions: pass in mc 'choices' index for student input (i.e. 0, 1, 2, 3, etc...)
      
      Example: 
      if you want to use the first option as an answer, pass in "0" as the studentInput
      "choices": [
            {
                "value": " 11",
                "isCorrect": true,
                "type": "choice"
            },
            {
                "value": " 14",
                "isCorrect": false,
                "type": "choice"
            },
            {
                "value": " 9",
                "isCorrect": false,
                "type": "choice"
            }
        ]
*/

Return Value

  • score: Total points scored.

  • scoreOutOf: Maximum possible points.

  • percentage: Percentage score.

{
  "score": 8,
  "scoreOutOf": 10,
  "percentage": 80
}

Last updated