ALL SPORTS API - Tennis Sockets API Version 2.1
Welcome to the documentation page of AllSportsAPI.com tennis service. Please find bellow the full list of the methods you can relay on to get real time tennis data helping you build awesome applications.
LiveScore AND Point By Point
wss://wsstennis.allsportsapi.com/live_events
After we have connected to it, it will push the client every time an event appears in the live score
Parameters
Parameter | Description |
---|---|
APIkey | Authorization code generated from your allsportsapi account |
timezone | The timezone where you want to receive the data in tz format (exemple: America/New_York). Default timezone: Europe/Berlin (Optional) |
countryId | Country ID - if set only events from specific country will be returned (Optional) |
leagueId | League ID - if set events from specific league will be returned (Optional) |
matchId | Match ID - if set only details from specific match will be returned (Optional) |
JSON Message Received
[ { "event_key": 11997080, "event_date": "2024-11-06", "event_time": "14:10", "event_first_player": "J. Burrage", "first_player_key": 1437, "event_second_player": "S. Ambrosio", "second_player_key": 2292, "event_final_result": "0 - 0", "event_game_result": "3 - 4", "event_serve": "First Player", "event_winner": null, "event_status": "Set 1", "country_name": "Itf Women Singles", "league_name": "ITF W35 Villeneuve d'Ascq Women", "league_key": 11999, "league_round": "ITF W35 Villeneuve d'Ascq Women - 1/8-finals", "league_season": "2024", "event_live": "1", "event_first_player_logo": "https://apiv2.allsportsapi.com/logo-tennis/1437_j-burrage.jpg", "event_second_player_logo": "https://apiv2.allsportsapi.com/logo-tennis/2292_s-ambrosio.jpg", "event_qualification": "False", "pointbypoint": [ { "set_number": "Set 1", "number_game": "1", "player_served": "First Player", "serve_winner": "First Player", "serve_lost": null, "score": "1 - 0", "points": [ { "number_point": "1", "score": "15 - 0", "break_point": null, "set_point": null, "match_point": null }, ............... ] }, .................... ], "scores": [ { "score_first": "6.3", "score_second": "6.4", "score_set": "1" }, ......... ], "statistics": [] }, ............... ]
Javascript call example
var APIkey='!_your_account_APIkey_!'; var socket = new WebSocket('wss://wsstennis.allsportsapi.com/live_events?APIkey='+APIkey+'&timezone=+03:00'); socket.onmessage = function(e) { if (e.data) { var matchesData = JSON.parse(e.data); // Now variable matchesData contains all matches that received an update // Here can update matches in dom from variable matchesData console.log(matchesData); } }