iQuiz

Netlify Status

API for getting/creating/deleting Quizzes and saving its results against a user.

Endpoints


Quizzes

For adding/deleting/updating and fetching Quizzes.

1. Get All Quiz

Get all Quizzes.

  • No specific input is required.

  • Quizzes are publically available.

  • Quizzes are not associated with any user.

Endpoint:

Method: GET
Type: 
URL: https://iquiz.onrender.com/api/v1/quiz/

2. Add New Quiz

Add new Quiz

  • name must be provided in the body in JSON format.
  • (Pending) Need to add an admin user to add Quiz.

Endpoint:

Method: POST
Type: RAW
URL: https://iquiz.onrender.com/api/v1/quiz/

Body:

{
    "name": "2026 Qestion papers"
}

3. Update Quiz Name

Update Quiz name

  • name must be provided in body in json format.
  • (Pending) Need to add admin user to update Quiz

Endpoint:

Method: PUT
Type: RAW
URL: https://iquiz.onrender.com/api/v1/quiz/

Body:

{
    "quizId" : "Quiz_ID",    
    "name": "2022 Murad course"
}

4. Delete Quiz

Delete Quiz

  • name must be provided in body in json format.
  • (Pending) Need to add admin user to delete Quiz.

Endpoint:

Method: DELETE
Type: RAW
URL: https://iquiz.onrender.com/api/v1/quiz/Quiz_ID

Question

This section is for adding/deleting questions in a quiz.

1. Get questions

Get all questions against a quiz id.

  • Input is category id in path params.
  • quiz id can be gotten from Get All Quzzies request.

Endpoint:

Method: GET
Type: 
URL: https://iquiz.onrender.com/api/v1/question/QUIZ_ID

2. add new Question

Add a new question against a Quiz. .

  • Input is must be in mentioned format.

Endpoint:

Method: POST
Type: RAW
URL: https://iquiz.onrender.com/api/v1/question/

Body:

{
    "quizId": "Quiz_ID",
    "question": "question 2",
    "options": [
      "Correct",
      "Wrong",
      "Wrong",
      "Wrong",
      "Wrong"
    ],
    "correctAnswer": "A"
  }

3. Upload Question in bulk

Add new questions against a Quiz through a file.

  • Input file must be in array of update question formate.

Endpoint:

Method: POST
Type: FORMDATA
URL: https://iquiz.onrender.com/api/v1/question/bulkUpload

Body:

Key Value Description
dataFile

4. Delete Question

Delete quiz

  • Input must be question id

  • question id can be get from Get quizzes request

Endpoint:

Method: DELETE
Type: 
URL: https://iquiz.onrender.com/api/v1/question/QUESTION_ID

User

For saving the history, user must login as saving and retriving quiz history.

1. Login User

Login User will return JWT Token.
Client must save it for history action.
(Pending) Currently admin user is pending

Endpoint:

Method: POST
Type: RAW
URL: https://iquiz.onrender.com/api/v1/user/

Body:

{
    "name": "Ali M",
    "phone": "+923244897384",
    "imageName": "1.png",
    "role": "user"
}

2. Get LoggedIn User

End point for getting current user.

Endpoint:

Method: GET
Type: 
URL: https://iquiz.onrender.com/api/v1/user/getUser

3. Update User details

Update user details.

  • name and imageName can be updated.
  • (Pending) Need to add admin user to update user.

Endpoint:

Method: PUT
Type: RAW
URL: https://iquiz.onrender.com/api/v1/user/

Body:

{
    "name": "Ali Farzan",
    "imageName": "2.png"
}

History

Saving and fetching quiz results.

1. Get All History Against User

Return all quiz attemped completed by user with some details(score, quiz name, attempted date)

Endpoint:

Method: GET
Type: RAW
URL: https://iquiz.onrender.com/api/v1/history

2. Get Detailed History

Return detail of single quiz in details with correct and selected option.

Endpoint:

Method: GET
Type: 
URL: https://iquiz.onrender.com/api/v1/history/QUIZ_ID

3. Save History

Save a quiz attempt in history.

Endpoint:

Method: POST
Type: RAW
URL: https://iquiz.onrender.com/api/v1/history/

Body:

{
    "quizID" : "Quiz_ID",
    "anwsers" : [
            "A",
            "B",
            "C",
            "D",
            "F"
    ]
    
}

Back to top

Generated at 2023-11-08 01:24:48 by docgen