Add a new question (structured or unstructured) to an existing exam. Only admins and lecturers can add questions.
POST
/api/v1/exam/{id}/add-question
curl \
--request POST 'https://api.echoplain.social/api/v1/exam/123e4567-e89b-12d3-a456-426614174000/add-question' \
--header "Content-Type: application/json" \
--data '{"options":["O(n)","O(log n)","O(n log n)","O(1)"],"maxScore":5,"orderIndex":1,"questionText":"What is the time complexity of binary search?","questionType":"STRUCTURED","correctAnswers":["O(log n)"]}'
Request examples
Multiple choice
{
"options": [
"O(n)",
"O(log n)",
"O(n log n)",
"O(1)"
],
"maxScore": 5,
"orderIndex": 1,
"questionText": "What is the time complexity of binary search?",
"questionType": "STRUCTURED",
"correctAnswers": [
"O(log n)"
]
}
{
"maxScore": 10,
"orderIndex": 2,
"questionText": "Explain the difference between a stack and a queue with examples.",
"questionType": "UNSTRUCTURED"
}
Response examples (201)
{
"message": "Question added successfully",
"question": {
"id": "q123-456",
"maxScore": 5,
"questionText": "What is the time complexity of binary search?",
"questionType": "STRUCTURED"
}
}