The single_answer_only
parameter is not required and allows you to filter questions so that only those with exactly one correct answer are returned.
This is especially useful when you want to create simpler quizzes where users don't need to select multiple options.
{info} This parameter is only available for the
/api/v1/questions
endpoint and not for the/api/v1/ai
endpoint.
The request would look something like this:
curl https://quizapi.io/api/v1/questions -G \
-d apiKey=YOUR_API_KEY \
-d single_answer_only=true
When you set single_answer_only=true
, you'll receive only questions where multiple_correct_answers
is false
. This means all returned questions will have exactly one correct answer among the available options.
[
{
"id": 1,
"question": "How to delete a directory in Linux?",
"description": "delete folder",
"answers": {
"answer_a": "ls",
"answer_b": "delete",
"answer_c": "remove",
"answer_d": "rmdir",
"answer_e": null,
"answer_f": null
},
"multiple_correct_answers": "false",
"correct_answers": {
"answer_a_correct": "false",
"answer_b_correct": "false",
"answer_c_correct": "false",
"answer_d_correct": "true",
"answer_e_correct": "false",
"answer_f_correct": "false"
},
"explanation": "rmdir deletes an empty directory",
"tip": null,
"tags": [],
"category": "linux",
"difficulty": "Easy"
}
]
{success} This parameter can be combined with other parameters such as
category
,difficulty
,tags
, andlimit
to further refine your search.