Quizzen API Documentation

Your guide to integrating with the Quizzen app

Overview

Welcome to the Quizzen API! This API allows users to manage authentication, quizzes, and quiz questions.

Base URL: https://emmanueldev247.publicvm.com/quizzen/api/v1

1. Authentication

POST /connect

Authenticates a user and generates a JWT token for subsequent requests.

Rate Limit: 5 requests per minute

Key Type Description Required
email String The user's email address. Yes
password String The user's password. Yes

Request Body (JSON):

{
  "email": "user@example.com",
  "password": "securepassword123"
}
        

Response (Success):

{
  "success": true,
  "access_token": "your_generated_token_here"
}
        

POST /disconnect

Logs out a user by blacklisting their JWT token.

Rate Limit: 5 requests per minute

Request Header:

Authorization: Bearer your_token_here
                

Response (Success):

{
  "success": true,
  "message": "Token successfully disconnected"
}
        

2. Quizzes

POST /quiz

Allows users to create a new quiz.

Rate Limit: 10 requests per minute

Request Header:

Authorization: Bearer your_token_here
                
Key Type Description Required
title String The title of the quiz Yes
description String A short description of the quiz. Optional
duration Integer Duration of quiz (in minute) Yes
public Boolean Determines if the quiz is public or private Optional
category_id Integer Sets the category of the quiz Optional

Request Body (JSON):

{
  "title": "Science Quiz",
  "description": "A fun science quiz for all ages",
  "duration": 30,
  "public": true
}
        

Response (Success):

{
  "success": true,
  "quiz_id": "12345",
  "message": "Quiz created successfully"
}
        

GET /quiz

Fetches all public quizzes available in the system.

Rate Limit: 20 requests per minute

Request Header:

Authorization: Bearer your_token_here
                

Response:

[
  {
    "id": "12345",
    "title": "Science Quiz",
    "description": "A fun science quiz for all ages"
  },
  {
    "id": "67890",
    "title": "Math Quiz",
    "description": "Test your math skills!"
  }
  ...
]
        

GET /quiz/me

Retrieve quizzes created by the logged-in user

Rate Limit: 20 requests per minute

Request Header:

Authorization: Bearer your_token_here
                

Response:

[
  {
    "id": "12345",
    "title": "Science Quiz",
    "description": "A fun science quiz for all ages"
  },
  {
    "id": "67890",
    "title": "Math Quiz",
    "description": "Test your math skills!"
  }
  ...
]
        

GET /quiz/<quiz_id>

Retrieve a specific quiz, including its paginated questions

Rate Limit: 20 requests per minute

Request Header:

Authorization: Bearer your_token_here
                

Response:

[
  {
    "id": "12345",
    "title": "Science Quiz",
    "description": "A fun science quiz for all ages",
    "questions": [
        {
            "id": "456",
            "question_type": "multiple_choice",
            "question_text": "What is an API?",
            "points": 1,
            "is_multiple_response": false,
            "answer_choices": [
                {
                    "id": "789",
                    "text": "API is ...",
                    "is_correct": true
                },
                ...
            ]
        },
        ...
    ]
  }
]

3. Questions

POST /question

Creates a new question and associates it with a quiz.

Request Header:

Authorization: Bearer your_token_here
                

Request Body (JSON):

{
  "quiz_id": "12345",
  "question_text": "What is the capital of France?",
  "answer_choices": [ 
        {
            "text": "Paris",
            "is_correct": true
        },
        {
            "text": "London",
            "is_correct": false
        },
        {
            "text": "Madrid",
            "is_correct": false
        }
    ]
}
        

Response (Success):

{
  "success": true,
  "message": "Question added successfully"
}