Trivia API
Zufalls-Quizfragen mit Antworten, gefiltert nach Thema und Schwierigkeit.
Anforderungsheader
| Name | Required | Description |
|---|---|---|
X-RapidAPI-Key | required | Your RapidAPI key. Get one free. |
X-RapidAPI-Host | required | trivia.p.rapidapi.com |
Endpunkte
/v1/trivia Get random trivia questions, optionally filtered by category and difficulty
Parameter
| Name | Type | Required | Default | Constraints |
|---|---|---|---|---|
category | string | optional | — | — |
difficulty | string | optional | — | matches easy|medium|hard |
limit | integer | optional | 1 | 1-10 |
Codebeispiele
curl --request GET \
--url 'https://trivia.p.rapidapi.com/v1/trivia?category=example&difficulty=example' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--header 'x-rapidapi-host: trivia.p.rapidapi.com' const url = "https://trivia.p.rapidapi.com/v1/trivia?category=example&difficulty=example";
const options = {
method: "GET",
headers: {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data); import requests
url = "https://trivia.p.rapidapi.com/v1/trivia"
querystring = {"category": "example", "difficulty": "example"}
headers = {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json()) /v1/trivia/categories List all trivia categories available in the dataset, sorted alphabetically.
Codebeispiele
curl --request GET \
--url 'https://trivia.p.rapidapi.com/v1/trivia/categories' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--header 'x-rapidapi-host: trivia.p.rapidapi.com' const url = "https://trivia.p.rapidapi.com/v1/trivia/categories";
const options = {
method: "GET",
headers: {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data); import requests
url = "https://trivia.p.rapidapi.com/v1/trivia/categories"
headers = {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
response = requests.get(url, headers=headers)
print(response.json()) /v1/trivia/difficulties List all difficulty levels available in the trivia dataset, sorted alphabetically.
Codebeispiele
curl --request GET \
--url 'https://trivia.p.rapidapi.com/v1/trivia/difficulties' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--header 'x-rapidapi-host: trivia.p.rapidapi.com' const url = "https://trivia.p.rapidapi.com/v1/trivia/difficulties";
const options = {
method: "GET",
headers: {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data); import requests
url = "https://trivia.p.rapidapi.com/v1/trivia/difficulties"
headers = {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "trivia.p.rapidapi.com"
}
response = requests.get(url, headers=headers)
print(response.json()) Interaktives Beispiel
$ GET /v1/trivia?difficulty=easy&limit=1
{"data":[{"question":"What is the largest planet in our solar system?","answer":"Jupiter","category":"Science","difficulty":"easy"}],"meta":{"total":1,"limit":1,"offset":0}} Abonnieren und lizenzieren
Greifen Sie auf diese API mit kommerziellen Stufen auf RapidAPI zu. Flexible Pläne für Nebenprojekte, Startups und großvolumige Produktionsarchitekturen.
Entwicklerunterstützung
Benötigen Sie Hilfe bei der Integration oder haben Sie eine individuelle Endpunktanfrage? Unser Technikteam ist hier, um Sie bei der Authentifizierung, Nutzlastschemata und der Erhöhung der Hochfrequenz-Ratenbegrenzung zu unterstützen.
Systemleistung
Rund um die Uhr überwacht mit einem SLA für eine Verfügbarkeit von 99,9 %. Basierend auf Cloud-nativen Microservices mit global verteiltem Edge-Caching, um Reaktionszeiten mit äußerst geringer Latenz zu gewährleisten.