Test a text-input question's answer matching
Method
| Method |
Description |
| exam.questionCheckTextMatch |
Test how one or more candidate answers would be graded against an existing text-input question. |
Tests up to 50 candidate answers per call against a text-input question's (see exam.questionCreate, type 7) accepted answers and similarity threshold - using the exact same matching logic as real exam grading. Read-only: nothing is saved or submitted, and no exam attempt is required.
Request parameters
{
"id": {QuestionId},
"exam_id": {ExamId},
"answers": [
"{CandidateAnswer}",
...
]
}
Response parameters
{
"results": [
{
"index": {ResultIndex},
"input": "{CandidateAnswer}",
"answered": {Answered},
"correct": {Correct},
"best_similarity": {BestSimilarity},
"matched_points": {MatchedPoints},
"total_points": {TotalPoints},
"matched_value": "{MatchedValue}",
"variants": [
{
"value": "{VariantValue}",
"similarity": {VariantSimilarity},
"is_match": {IsMatch}
},
...
]
},
...
],
"threshold": {Threshold},
"case_sensitive": {CaseSensitive},
"question_points": {QuestionPoints}
}
Parameters meaning
| Variable |
Type |
Appearance |
Description |
| {QuestionId} |
Integer |
Mandatory |
Question id. Must be a text-input question. |
| {ExamId} |
Integer |
Mandatory |
Exam id. |
| {CandidateAnswer} |
Array |
Mandatory |
One or more candidate answer texts to test. Must be non-empty and contain no more than 50 entries. |
| response |
| results |
Array |
Mandatory |
One entry per candidate in the request's answers array, in the same order. |
| {ResultIndex} |
Integer |
Mandatory |
0-based position of this entry within the request's answers array. |
| {CandidateAnswer} |
String |
Mandatory |
The candidate answer text that was tested (echoed back). |
| {Answered} |
Boolean |
Mandatory |
false only when the candidate text is empty/whitespace-only - matches how a real exam attempt treats a blank answer as "not answered" rather than "incorrect". |
| {Correct} |
Boolean |
Mandatory |
Whether this candidate would be marked correct - true when its similarity to at least one accepted answer reaches the question's threshold. |
| {BestSimilarity} |
Number |
Mandatory |
The highest similarity percentage (0-100) reached against any accepted answer - the winning match when correct is true, otherwise the closest miss. |
| {MatchedPoints} |
Integer |
Mandatory |
The matched accepted answer's own points (per-answer bonus points, set on that specific accepted answer). 0 when correct is false, or when no per-answer points were set. This is not the full score for the question - see total_points. |
| {TotalPoints} |
Integer |
Mandatory |
The full points this candidate would actually add to the exam score: the question's own base points ({QuestionPoints}) plus matched_points. Real exam grading awards the question's base points on any correct answer, regardless of question type, in addition to any per-answer points. 0 when correct is false. |
| {MatchedValue} |
String / false |
Mandatory |
The accepted answer text behind best_similarity - the winning match when correct is true, or the closest miss when correct is false. false only when the question has no accepted answers defined yet. |
| variants |
Array |
Mandatory |
This candidate's similarity against every individual accepted answer, not just the winning one - useful for tuning the threshold or spotting an overly strict/loose variant. |
| {VariantValue} |
String |
Mandatory |
One accepted answer's text. |
| {VariantSimilarity} |
Number |
Mandatory |
Similarity percentage (0-100) between the candidate and this specific accepted answer. |
| {IsMatch} |
Boolean |
Mandatory |
Whether this specific accepted answer's similarity to the candidate reaches the question's threshold on its own. |
| {Threshold} |
Integer |
Mandatory |
The question's own similarity threshold (0-100), echoed for convenience. |
| case_sensitive |
Boolean |
Mandatory |
The question's own case-sensitivity setting, echoed for convenience. |
| {QuestionPoints} |
Integer |
Mandatory |
The question's own base points - awarded on any correct answer to this question, in addition to matched_points. Echoed here for convenience; see total_points in each result entry. |