Match events
This live-score api endpoint allows you to get goal times, goal scorers as well as yellow and red cards information for live football matches as well as finished ones.
ENDPOINT
In order, to get the events of currently played football matches or finished games from our history database (if we provide such for this game), the only thing you need to do is the call the url bellow. In the beginning the data
array will be empty as there are no events that have happened. Once there are events, they will start appearing in the result from the football API endpoint. To make this API call you will need the id
of the football match. Our live-scores api endpoint provides information about the matches for which you can get data, by providing you with the link to the events api call. In this example, we have used your api key and secret pair. If you copy the URL it will work straight away.
Parameters
Name | Type | Required | Example | Description |
---|---|---|---|---|
id | Number | 1 | 129180 | The id of the match for which we want the events |
lang | String | ar | The 2 letter code of one of the supported languages. This is only available for special competitions |
RESPONSE
The response contains the following information, for every
event element in the list. The same rules apply for the JSON objects and the XML tag elements. In addition to the list with the events, this football API endpoint also provides the general match information.
Name | Type | Example | Description |
---|---|---|---|
event | String | YELLOW_CARD | The type of the event. Check the reference table below. |
home_away | String | h/a | Indicator whether the player or event is related to the home team (value is h ) or the away team (values is a ). |
match_id | Number | 18098 | The id of the match in which the event occurred. |
player | String | Paul Pogba | The name of the player who is connected to the event. |
sort | Number | 8 | The order in which the events occurred starting from 0 and growing in positive numbers direction. Meaning the event number 2 happened before number 3. This will be helpful when 2 events in our real time match events data feed happen in the same minute. |
time | Number | 38 | The minute since the kick-off when the event occurred. |
{
"success": true,
"data": {
"event": [
{
"id": "10509914",
"match_id": "129180",
"player": "DEENEY TROY",
"time": "5",
"event": "GOAL",
"sort": "0",
"home_away": "h"
},
{
"id": "10509915",
"match_id": "129180",
"player": "MARIAPPA ADRIAN",
"time": "13",
"event": "YELLOW_CARD",
"sort": "1",
"home_away": "h"
},
{
"id": "10509916",
"match_id": "129180",
"player": "CAPOUE ETIENNE",
"time": "60",
"event": "YELLOW_CARD",
"sort": "2",
"home_away": "h"
},
{
"id": "10509917",
"match_id": "129180",
"player": "DOUCOURE ABDOULAYE",
"time": "61",
"event": "YELLOW_CARD",
"sort": "3",
"home_away": "h"
},
{
"id": "10509918",
"match_id": "129180",
"player": "DEENEY TROY",
"time": "62",
"event": "YELLOW_CARD",
"sort": "4",
"home_away": "h"
},
{
"id": "10510529",
"match_id": "129180",
"player": "VARDY JAMIE",
"time": "75",
"event": "GOAL",
"sort": "5",
"home_away": "a"
},
{
"id": "10510974",
"match_id": "129180",
"player": "PEREIRA RICARDO",
"time": "84",
"event": "YELLOW_CARD",
"sort": "6",
"home_away": "a"
},
{
"id": "10511398",
"match_id": "129180",
"player": "GRAY ANDRE",
"time": "90",
"event": "GOAL",
"sort": "7",
"home_away": "h"
},
{
"id": "10511625",
"match_id": "129180",
"player": "GRAY ANDRE",
"time": "90",
"event": "YELLOW_CARD",
"sort": "8",
"home_away": "h"
}
],
"match": {
"id": "129180",
"date": "2019-03-03",
"home_name": "Watford",
"away_name": "Leicester City",
"score": "2 - 1",
"ht_score": "1 - 0",
"ft_score": "2 - 1",
"et_score": "",
"time": "FT",
"league_id": "25",
"status": "FINISHED",
"added": "2019-03-03 11:55:12",
"last_changed": "2019-03-03 13:58:04",
"home_id": "11",
"away_id": "6",
"competition_id": "2",
"location": null,
"fixture_id": null,
"scheduled": null,
"home": {
"id": "11",
"name": "Watford",
"stadium": "Vicarage Road Stadium",
"location": "Vicarage Road Stadium"
},
"away": {
"id": "6",
"name": "Leicester City",
"stadium": "King Power Stadium",
"location": "King Power Stadium"
},
"competition": {
"id": "2",
"name": "Premier League"
}
}
}
}
Type Meaing GOAL A goal was scored GOAL_PENALTY A goal was scored from a penalty OWN_GOAL An own goal was scored YELLOW_CARD A player has been cautioned by the referee RED_CARD A player was sent off by the referee YELLOW_RED_CARD A player has received their second yellow card and they have been sent off. SUBSTITUTION A player coming on the pitch instead of someone of his teammates MISSED_PENALTY When a player misses a penalty
CODE EXAMPLES
To get the events from any match that has events: cUrl:
curl -XGET "https://livescore-api.com/api-client/scores/events.json?key=demo_key&secret=demo_secret&id=129180"
PHP:
file_get_contents('https://livescore-api.com/api-client/scores/events.json?key=demo_key\&secret=demo_secret\&id=129180');
Python:
import urllib2
req = urllib2.Request('https://livescore-api.com/api-client/scores/events.json?key=demo_key\&secret=demo_secret\&id=129180')
response = urllib2.urlopen(req)
print response.read()
To get the events from a special competition that supports events translations. In order, for the translations to work you need to have the correct package purchased. Otherwise, the player names will be listed in English. cUrl:
curl -XGET "https://livescore-api.com/api-client/scores/events.json?key=demo_key&secret=demo_secret&id= 335680&lang=ar"
PHP:
file_get_contents('https://livescore-api.com/api-client/scores/events.json?key=demo_key\&secret=demo_secret\id= 335680\&lang=ar');
Python:
import urllib2
req = urllib2.Request('https://livescore-api.com/api-client/scores/events.json?key=demo_key\&secret=demo_secret\&id= 335680&lang=ar')
response = urllib2.urlopen(req)
print response.read()