Skip to content

Grades a quiz lesson submission, stores the attempt and returns the per-question result with the score.

Answers are keyed by question slug in answers; unanswered questions are skipped rather than marked wrong. Written answers are length-capped at 500 characters for exact-match grading and 10 000 otherwise. The caller must be enrolled and the quiz lesson must be published.

Endpoint

  • Method: POST

  • Path: /courses/{course_id}/lessons/{lesson_id}/quiz/submit

  • Edition: PRO

  • Controller: FluentCommunityPro\App\Modules\Quiz\Http\Controllers\QuizController@submitQuiz

  • Route source: fluent-community-pro/app/Modules/Quiz/Http/quiz_api.php:8

  • Requires FluentCommunity Pro with the Quiz module.

Live sample

The request and response below were recorded against a running FluentCommunity install and then anonymised — member names, emails, avatars and post content are fictional, and long collections are trimmed to a few entries.

POST Submit Lesson Quiz

POST
/courses/{course_id}/lessons/{lesson_id}/quiz/submit

Grades a quiz lesson submission, stores the attempt and returns the per-question result with the score.

Controller: FluentCommunityPro\App\Modules\Quiz\Http\Controllers\QuizController@submitQuiz
Route source: fluent-community-pro/app/Modules/Quiz/Http/quiz_api.php:8

Authorizations

ApplicationPasswords

WordPress Application Passwords — use Basic auth with username:application_password.

Type
API Key (header: Authorization)

Request Body

application/json
JSON
{
  
"answers": {
  
  
"q1": "string",
  
  
"q2": [
  
  
  
"string"
  
  
]
  
}
}

Responses

Successful response

application/json
JSON
{
  
"message": "string",
  
"result": {
  
  
"content_type": "string",
  
  
"id": 0,
  
  
"message": {
  
  
  
"q1": {
  
  
  
  
"is_correct": true,
  
  
  
  
"user_answer": "string"
  
  
  
},
  
  
  
"q2": {
  
  
  
  
"is_correct": true,
  
  
  
  
"user_answer": [
  
  
  
  
  
"string"
  
  
  
  
]
  
  
  
}
  
  
},
  
  
"meta": {
  
  
  
"attempts": 0,
  
  
  
"correct_answers": 0,
  
  
  
"total_questions": 0
  
  
},
  
  
"parent_id": "string",
  
  
"post_id": "string",
  
  
"score": "string",
  
  
"status": "string",
  
  
"type": "string",
  
  
"updated_at": "string",
  
  
"user_id": "string"
  
}
}

Playground

Authorization
Body

Samples

Powered by VitePress OpenAPI

FluentCommunity developer documentation