# /get-grades

**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 is passed, we will <strong>fetch ALL submissions for this quiz</strong>.</p> |

**Example Request**

```javascript
// Example to get grades
fetch("https://api.arlinear.com/functions/v1/get-grades", {
  method: "POST",
  headers: {
    Authorization: "<Your API Key>",
  },
  body: JSON.stringify({
    quizId: "ba777045-7033-4701-b17b-da9e90dcd41e",
    primaryKey: "emily@school.com", // optional: if no PK is passed, we will fetch ALL submissions for this quiz
  }),
});
```

**Example Return Value**

Returns a list of quiz submissions.

* `primaryKey`: The primary key for the student.
* `score`: Total points scored.
* `scoreOutOf`: Maximum possible points.
* `createdAt` : Date when the student submitted the quiz.
* `corrections`: An array of corrections for each question.

**Note:** if no `primaryKey` is passed, we will fetch ALL submissions for this quiz.

```json
[
  {
    "primaryKey": "emily@school.com",
    "score": 8,
    "scoreOutOf": 10,
    "createdAt": "2023-11-17T20:20:29.644882+00:00",
    "corrections": [
      {
    	  "studentInput": "y=6",
    	  "score":  1,
    	  "scoreOutOf":  1,
    	  "feedback":  "Correct answer. Great job!"
      },
      ...
     ]
  }
]
```
