CourseController::examResults(). Identical mechanics to the quiz results endpoint — see GET_quiz_results.md — except an exam is not scoped to a module.{exam} is route-model-bound to App\Models\CourseLog\Exam by its primary key. Ownership is checked inline: $exam->log_code !== $log_code || $exam->user_id !== auth()->id() returns 403.App\Http\Controllers\Api\V1\Diver\CourseController::examResults()api.v1.diver.courses.exam.resultsAuthorization: Bearer {token}GET/api/v1/diver/courses/{log_code}/exam/{exam}| Parameter | Type | Description |
|---|---|---|
{log_code} | string(32) | Opaque course log code |
{exam} | integer | Exam attempt id, route-model-bound |
200 OK_resources.md → "Exam result".{
"success": true,
"status": "success",
"message": "OK",
"data": {
"id": 7063,
"log_code": "f7efa55017629461ccd0b8bf303bfb91",
"total": 45,
"correct": 45,
"wrong": 0,
"score": 100,
"passed": true,
"date": "2014-11-28",
"start": "2014-11-28 03:56:06",
"end": "2014-11-28 04:09:25",
"questions": [
{
"id": 1418,
"text": "Can you hold your breath at any time while diving or hovering?",
"missing": false,
"answers": [
{ "id": 5641, "text": "Yes", "is_correct": false, "selected": false },
{ "id": 5642, "text": "No, never hold your breath while diving", "is_correct": true, "selected": true }
]
}
]
}
}_resources.md → "Exam result". No module_id — the one field that differs from the quiz result shape.401 Unauthorized{
"success": false,
"status": "error",
"message": "Unauthenticated"
}403 Forbidden{exam} exists but does not belong to {log_code} or to the authenticated user.{
"success": false,
"status": "error",
"message": "Forbidden"
}404 Not Found{exam} does not exist at all.{
"message": "No query results for model [App\\Models\\CourseLog\\Exam] 999999999"
}is_correct flag — same caveat as the quiz result endpoint.docs/api/diver/courses/GET_exam_results.mdcurl --location 'https://test.diveraid.com/api/v1/diver/courses//exam/' \
--header 'Authorization: Bearer <token>'{
"status": "success",
"message": "string",
"data": {
"id": 0,
"log_code": "string",
"total": 0,
"correct": 0,
"wrong": 0,
"score": 0,
"passed": true,
"date": "2019-08-24",
"start": "2019-08-24T14:15:22.123Z",
"end": "2019-08-24T14:15:22.123Z",
"questions": [
{
"id": 0,
"text": "string",
"missing": true,
"answers": [
{
"id": 0,
"text": "string",
"is_correct": true,
"selected": true
}
]
}
]
}
}