Schnellstart: Ihr erster MotoGP-API-Aufruf
Abonnieren Sie auf RapidAPI, senden Sie zwei Header und lesen Sie die aktuelle MotoGP-Meisterschaftswertung in curl, JavaScript oder Python.
5 Min. Lesezeit
In dieser Anleitung kommen Sie in etwa fünf Minuten von null zu einer funktionierenden Anfrage. Sie benötigen ein RapidAPI-Konto und ein Terminal.
1. Abonnieren und Schlüssel kopieren
- Öffnen Sie die MotoGP API auf RapidAPI und wählen Sie einen Tarif.
- Kopieren Sie im RapidAPI-Playground den Wert von X-RapidAPI-Key. Dieser Schlüssel identifiziert Ihr Abonnement; RapidAPI misst Ihr Kontingent darüber.
Speichern Sie den Schlüssel in einer Umgebungsvariable, statt ihn in den Code einzufügen:
export RAPIDAPI_KEY="paste-your-key-here"
2. Erste Anfrage senden
Jede Anfrage benötigt zwei Header: Ihren Schlüssel und den API-Host.
curl -s "https://motogp-api-championship-data-statistics.p.rapidapi.com/standings/seasons/2026/riders?category=MOTOGP" \
-H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: motogp-api-championship-data-statistics.p.rapidapi.com"
Die Antwort ist die Fahrerwertung der MotoGP-Meisterschaft 2026, bereits nach Platzierung sortiert:
{
"data": [
{
"position": 1,
"total_points": 365,
"wins": 6,
"podiums": 6,
"season_year": 2026,
"rider_name": "Marc Márquez",
"rider_number": 93,
"team_name": "Ducati Lenovo Team",
"category": "MOTOGP"
}
],
"meta": { "total": 32, "page": null, "size": null, "total_pages": null }
}
3. Die Saison nicht fest codieren
GET /seasons/latest liefert die aktuellste Saison, sodass Ihr Code auch nach dem Start einer neuen
Meisterschaft weiterläuft. Verketten Sie den Aufruf mit der Wertung:
JavaScript (Node.js 18+)
const HOST = "motogp-api-championship-data-statistics.p.rapidapi.com";
const headers = {
"X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
"X-RapidAPI-Host": HOST,
};
async function get(path) {
const res = await fetch(`https://${HOST}${path}`, { headers });
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.message ?? res.statusText}`);
return body.data;
}
const season = await get("/seasons/latest");
const standings = await get(`/standings/seasons/${season.year}/riders?category=MOTOGP`);
for (const row of standings.slice(0, 5)) {
console.log(`${row.position}. ${row.rider_name} (#${row.rider_number}) – ${row.total_points} pts`);
}
Python
import os
import requests
HOST = "motogp-api-championship-data-statistics.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}
def get(path: str, **params):
res = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=10)
res.raise_for_status()
return res.json()["data"]
season = get("/seasons/latest")
standings = get(f"/standings/seasons/{season['year']}/riders", category="MOTOGP")
for row in standings[:5]:
print(f"{row['position']}. {row['rider_name']} (#{row['rider_number']}) – {row['total_points']} pts")
Ausgabe:
1. Marc Márquez (#93) – 365 pts
2. Jorge Martín (#89) – 355 pts
3. Marco Bezzecchi (#72) – 315 pts
...
Nächste Schritte
- Lesen Sie die Konventionen zu Kategorien, Paginierung, Fehlern und Caching.
- Bauen Sie eine Wertungstabelle für Ihre Website.
- Alle Endpunkte finden Sie in der MotoGP-API-Referenz.