# /submit-quiz

**Input Parameters**

| Parameter    | Type                            | Description                                                                                                                                                                                                               |
| ------------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| quizId       | `String`                        | The unique identifier for the quiz.                                                                                                                                                                                       |
| primaryKey   | `String`                        | <p>The primary key for the student. <br><br><strong>Optional:</strong> If no PK then the submission will not be saved. Request will just return the graded submission.</p>                                                |
| studentInput | Array of `Strings` or `Numbers` | <p>The answers submitted by the student.<br><br><code>String</code> for <strong>free form</strong> questions.</p><p><br><code>Number</code> for <strong>index</strong> of <strong>multiple choice</strong> questions.</p> |

**Example Request**

```javascript
// 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.

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