Documentation

Learning

Submit quiz answers

Submits answers for a quiz content item. Returns the score, correct answers, and explanations. Only works for quiz content (type >= 3).

ProductionStagingUAT
POSThttps://ankiren.com/api/courses/{courseId}/content/{contentId}/submit

Parameters

Path Parameters

  • courseIdintegerpathRequired
  • contentIdintegerpathRequired

Request Body

Bắt buộc.

  • answers[object]Required
    • questionIdintegerRequired
    • answerIdintegerRequired
application/json
{
  "answers": [
    {
      "questionId": 0,
      "answerId": 0
    }
  ]
}

Responses

200 · Quiz results

  • successboolean
  • scoreinteger

    Score as percentage (0-100)

  • correctCountinteger
  • totalQuestionsinteger
  • answeredCountinteger
  • results[object]
    • questionIdinteger
    • answerIdinteger
    • isCorrectboolean
    • correctAnswerIdinteger?
    • explanationstring?
  • progressUserContentProgress
    • idinteger
    • userIdstring
    • contentIdinteger
    • status"not_started" | "in_progress" | "completed"
    • scoreinteger?

      Quiz score as percentage (0-100)

    • totalQuestionsinteger?
    • completedAtstring<date-time>?
      format: date-time
    • updatedAtstring<date-time>
      format: date-time
application/json
{
  "success": true,
  "score": 80,
  "correctCount": 8,
  "totalQuestions": 10,
  "answeredCount": 10,
  "results": [
    {
      "questionId": 0,
      "answerId": 0,
      "isCorrect": true,
      "correctAnswerId": 0,
      "explanation": "string"
    }
  ],
  "progress": {
    "id": 1,
    "userId": "user_abc123",
    "contentId": 1,
    "status": "completed",
    "score": 85,
    "totalQuestions": 10,
    "completedAt": "2026-01-01T00:00:00.000Z",
    "updatedAt": "2026-01-01T00:00:00.000Z"
  }
}

Sample Code

Đổi ngôn ngữ ở ô Language trên thanh Documentation.

cURL
curl -X POST 'https://ankiren.com/api/courses/{courseId}/content/{contentId}/submit' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "answers": [
    {
      "questionId": 0,
      "answerId": 0
    }
  ]
}'