To build a live scorecard with complete match statistics, the Match API is required. The Match API gives the full details of the match like the Toss Information, Wicket, Runs, Stats, Squad, Playing XI and much more.
The Scorecard created using Match API. The Scorecard access based on the match access. Every plan can get the scorecard of the live match. The Scorecard match access is different for every plan. Here is the match access for all the plans.
Every match has a unique identification key called Match Key. The Match Key fetched from Recent Matches API and the Schedule API.
Match API Request Format:
https://rest.cricketapi.com/rest/v2/match/MATCH_KEY/?access_token=ACCESSTOKEN
The recent matches API gives all the live match key & details, 3 recent match key & details, and the 3 completed match key & details.
To get the match key, refer {data.cards.[key]}
.
To call the live match, refer {data.cards.[status:”started”]}
.
The Schedule API gives the general schedule & season based schedule of the match based on the plan access.
In Schedule API, refer {data.months.days.matches.[key]}
.
To get the live score in the Match API, refer {data.[now]}
.
To get the playing XI, refer {data.teams.[playing_xi]}
.
To get the detailed scorecard which includes innings, batting order, bowling order, fall of wickets, wickets order refer the following path of the Match API {data.[innings]}
.
Get the each player stats for that match in {data.players.(player_key).match.innings}
.
The ball by Ball API provides the detailed ball by ball updates. It gives details about balls of requested over. If the over key is not provided with the request, the response will have 1st over of 1st innings.
Ball By Ball API Sample Request:
https://rest.cricketapi.com/rest/v2/match/MATCH_KEY/balls/?access_token=ACCESS_TOKEN
Current Over:
To get the current over, refer the next_over value from the ball by ball response, when its return null (next_over: null) & status will be status: started then we can assume the current over response is over.
Finishing Over:
To know the finishing over, loop the next_over until the next over is changed as "null" next_over: null
& status is changed as status: completed
.