POST /api/v1/cats/{id}/new-question

Creates a new question for a specific CAT. Questions can be:

STRUCTURED: Multiple choice questions that are auto-gradable - Must include 'options' array with answer choices - Must include 'correctAnswers' array with correct options - Will be automatically graded when students submit

UNSTRUCTURED: Open-ended questions requiring manual grading - Only need 'question' text and 'maxScore' - 'options' and 'correctAnswers' are ignored for this type - Require manual grading by lecturers

Examples: - STRUCTURED: "What is 2+2?" with options ["3", "4", "5"] and correctAnswers ["4"] - UNSTRUCTURED: "Explain the concept of inheritance in OOP" (no options needed)

Path parameters

  • id string Required

    CAT ID where the question will be added

application/json

Body Required

Question data including content, type, options, and marks

  • question string Required
  • type string Required

    Type of question: STRUCTURED (MCQ, auto-gradable) or UNSTRUCTURED (open-ended, essay)

    Values are STRUCTURED or UNSTRUCTURED.

  • options array[string]

    Options for structured questions (MCQ). Required for STRUCTURED type, ignored for UNSTRUCTURED

  • correctAnswers array[string]

    Correct answers for auto-grading. Required for STRUCTURED type, ignored for UNSTRUCTURED

  • maxScore number Required

    Maximum score/marks for this question

Responses

  • 201 application/json

    Question added successfully

  • 400

    Invalid question data

  • 403

    Insufficient permissions - requires ADMIN or LECTURER role

  • 404

    CAT not found

POST /api/v1/cats/{id}/new-question
curl \
 --request POST 'http://localhost:3500/api/v1/cats/123e4567-e89b-12d3-a456-426614174000/new-question' \
 --header "Content-Type: application/json" \
 --data '{"question":"string","type":"STRUCTURED","options":["string"],"correctAnswers":["string"],"maxScore":42.0}'
Request examples
{
  "question": "string",
  "type": "STRUCTURED",
  "options": [
    "string"
  ],
  "correctAnswers": [
    "string"
  ],
  "maxScore": 42.0
}
Response examples (201)
{
  "message": "Question added successfully",
  "question": {
    "id": "456e7890-e89b-12d3-a456-426614174001",
    "type": "MULTIPLE_CHOICE",
    "marks": 2,
    "options": [
      "Paris",
      "London",
      "Berlin",
      "Madrid"
    ],
    "question": "What is the capital of France?",
    "correctAnswer": "Paris"
  }
}