Welcome to Quiz Backend, a backend service built using Spring Boot with Java, designed to manage quiz sessions, questions, and user performance. This repository contains the REST controllers for managing the core application features like quiz management and performance tracking.
- Quiz session management with total questions and correct answers tracking.
- Question management including creation, retrieval, and random selection.
- Performance tracking with the ability to submit answers and calculate correct answers.
- Standardized error handling with meaningful response messages.
Starts a new quiz session for the user.
-
POST /api/quiz/start
Starts a new quiz session.- Request Parameter:
userId
- The ID of the user starting the quiz. - Response:
200 OK
: Returns thequizSessionId
for the session.
- Request Parameter:
Fetches a shuffled list of questions for the specified session.
-
GET /api/quiz/questions
Retrieves a list of random quiz questions for a session.- Request Parameter:
sessionId
- The ID of the quiz session to fetch questions for. - Response:
200 OK
: Returns a list of shuffled questions.404 Not Found
: If the session is invalid or not found.
- Request Parameter:
Submits an answer for a specific question in the quiz session.
-
POST /api/quiz/answer
Submits the selected answer for a quiz question.- Request Parameters:
quizSessionId
- The ID of the quiz session.questionId
- The ID of the question being answered.selectedOption
- The option selected by the user (e.g., "a", "b", "c", or "d").
- Response:
204 No Content
: Successfully submitted the answer.
- Request Parameters:
Fetches the performance details for a specific quiz session, including the number of correct answers and total questions.
-
GET /api/quiz/performance
Retrieves the performance details for a user’s quiz session.- Request Parameter:
quizSessionId
- The ID of the quiz session for which the performance is requested. - Response:
200 OK
: Returns the performance data including the number of correct answers and total questions answered.
- Request Parameter:
Feel free to reach out for any questions or contributions:
- Email: inderjeetdev33@example.com
- GitHub: https://github.com/inderjeet29