Decide what to show
Start by deciding what you need to show. A live score card needs fixtures, status and the current score. A match centre adds scorecards. Fewer endpoints means faster delivery and a smaller bill.
Make the first call
Make your first call with your key in the header and check the shape of the response. Store the event ID from the fixtures call, because every later call for that match uses it.
import requests
r = requests.get("https://api.example.com/v1/cricket/fixtures",
params={"status": "live"},
headers={"x-api-key": KEY})
for m in r.json()["events"]:
print(m["home"]["name"], m["home"]["score"])Model cricket scores properly
Cricket scores are not a single number, so keep runs, wickets and overs as separate fields in your own model. Poll live matches every few seconds, and fixtures far less often.
Handle awkward states
Before launch, handle the awkward states: breaks, rain delays, abandoned matches and amended results.
Next step: tell us what you are building and we will point you to the right endpoints.