La documentation pour développeurs est en anglais.
Type de carte
quiz
One multiple-choice question with the answer key, so the client grades locally. The next question, and the grading of the reply, come when the user's reply follows our question's text unchanged; the last answer, or stopping, is a text-only answer (with the score once a question was answered).
Version 1 · schema quiz.v1.schema.json
Not answered yet: the API sends no quiz cards for now, and such questions come back matched: false (not billed). The type stays in the contract, so handle it like any other.
Layouts
Every card type has full. Pick a layout with the element's layout attribute, render.layout, or a theme.
Fields
The fields of card.data. Values a source doesn't provide are null; new optional fields can appear within version 1.
| Field | Type | Required | Notes |
|---|---|---|---|
topic | string | yes | |
index | integer | yes | |
total | integer | yes | |
question | string | yes | |
options[] | object[] | yes | |
options[].key | string | yes | |
options[].text | string | yes | |
answer_key | string | yes | |
explanation | string | yes | |
score | integer | null | Correct answers so far in this round. | |
previous | null | object | yes | How the user did on the previous question of the round, if any. |
previous.given | string | yes | |
previous.correct | boolean | yes | |
previous.correct_answer | string | yes |
Example
A recorded answer to “Quiz me on world capitals”. Open it in the Answer Lab to see every layout and style.
{
"v": 2,
"id": "ans_dnzgrfmzirz1b6pg",
"matched": true,
"locale": "en",
"skill": "quiz",
"confidence": 0.9,
"text": "Question 1 of 5 (World capitals): What is the capital city of Costa Rica? A) Majuro, B) San Jose, C) Port of Spain, D) Andorra la Vella.",
"speech": "Let's play! Question 1 of 5: What is the capital city of Costa Rica? A: Majuro, B: San Jose, C: Port of Spain or D: Andorra la Vella.",
"card": {
"type": "quiz",
"version": 1,
"data": {
"topic": "World capitals",
"index": 1,
"total": 5,
"question": "What is the capital city of Costa Rica?",
"options": [
{
"key": "A",
"text": "Majuro"
},
{
"key": "B",
"text": "San Jose"
},
{
"key": "C",
"text": "Port of Spain"
},
{
"key": "D",
"text": "Andorra la Vella"
}
],
"answer_key": "B",
"explanation": "",
"score": 0,
"previous": null
}
},
"sources": [
{
"name": "The Trivia API",
"url": "https://the-trivia-api.com/",
"license": "CC BY-NC 4.0"
}
],
"follow_ups": [
"Skip",
"Stop the quiz"
],
"actions": [],
"usage": {
"billable": true
}
}