Web Quiz Engine is a RESTful API-based quiz management system created as a project for JetBrains Academy. Explore the world of secure and interactive quizzes with Web Quiz Engine.
- Java 11+
- Spring Boot
- Spring Security
- Spring JPA
- H2 Database
- REST API Design
- Endpoint:
POST /api/register
- Authentication: Not required
- Request Body:
{
"email": "<username>@<domain>.<extension>",
"password": "<string, at least 5 characters long>"
}
- Description: Users can register using their email and a password. The system checks if the email is unique and saves it in the database if available.
-
Endpoint:
GET /api/quizzes
-
Authentication: Required
-
Request Parameter:
page
for pagination:/api/quizzes?page={number}
-
Response:
{
"totalPages": 1,
"totalElements": 3,
"last": true,
"first": true,
"sort": {},
"number": 0,
"numberOfElements": 3,
"size": 10,
"empty": false,
"pageable": {},
"content": [
{
"id": <quiz id>,
"title": "<string>",
"text": "<string>",
"options": ["<string>", "<string>", "<string>", ...]
},
{
"id": <quiz id>,
"title": "<string>",
"text": "<string>",
"options": ["<string>", "<string>", ...]
},
{
"id": <quiz id>,
"title": "<string>",
"text": "<string>",
"options": ["<string>", "<string>", ...]
}
]
}
- Description: Authenticated users can access a list of quizzes. The response includes pagination details.
- Endpoint:
POST /api/quizzes
- Authentication: Required
- Request Body:
{
"title": "<string, not null, not empty>",
"text": "<string, not null, not empty>",
"options": ["<string 1>", "<string 2>", "<string 3>", ...],
"answer": [<integer>, <integer>, ...]
}
- Response:
{
"id": <integer>,
"title": "<string>",
"text": "<string>",
"options": ["<string 1>", "<string 2>", "<string 3>", ...]
}
- Description: Authenticated users can create quizzes with specified titles, questions, options, and correct answers. Successful creation results in a response containing quiz details.
-
Endpoint:
GET /api/quizzes/{id}
-
Authentication: Required
-
Response: Returns quiz details by ID or
404 NOT FOUND
if the quiz doesn't exist.
- Endpoint:
POST /api/quizzes/{id}/solve
- Authentication: Required
- Request Body:
{
"answer": [<integer>, <integer>, ...]
}
- Response:
{
"success": true,
"feedback": "Congratulations, you're right!"
}
- Description: Authenticated users can submit answers to quizzes. The system provides feedback based on correctness.
- Endpoint:
DELETE /api/quizzes/{id}
- Authentication: Required
- Description: Users can delete quizzes they've created. Successful deletion results in a
204 (NO CONTENT)
status. If the specified quiz doesn't exist, the server returns404 (NOT FOUND)
. If the specified user is not the author of this quiz, the response is403 (FORBIDDEN)
.
-
Endpoint:
GET /api/quizzes/completed
-
Authentication: Required
-
Response:
{
"totalPages": 1,
"totalElements": 5,
"last": true,
"first": true,
"empty": false,
"content": [
{
"id": <quiz id>,
"completedAt": "<date_time>"
},
{
"id": <quiz id>,
"completedAt": "<date_time>"
},
{
"id": <quiz id>,
"completedAt": "<date_time>"
},
{
"id": <quiz id>,
"completedAt": "<date_time>"
},
{
"id": <quiz id>,
"completedAt": "<date_time>"
}
]
}
- Description: Authenticated users can view quizzes they've answered correctly. The response includes pagination details.
This project is licensed under the MIT License.
This project was based on https://hyperskill.org/projects/91.