Games
Learn to use the Games widget and the functionalities of different tags we can use with it.
We'll cover the following
View fixtures
The list of matches that pass the filter of the provided parameters is displayed by the Games widget. These matches are automatically updated according to the frequency selected in the data-refresh
parameter.
Games widget parameters
The following table contains some tags for the Games widget and their functionalities:
Tags | Type | Category | Description |
| String | Required | This is the hostname. It is |
| String | Required | This parameter specifies the API key that'll be used for request validation. |
| Integer | Optional | This is an integer corresponding to the number of seconds after which the list updates. It must be an integer greater than |
| String | Optional | This is the date of the desired fixture. The format is "YYYY-MM-DD." |
| Integer | Optional | This contains the league ID of the league we want to view the fixtures for. |
| Integer | Optional | This contains the team ID of the team we want to view the fixtures for. |
| Integer | Optional | This contains the year of the desired season. The format is "YYYY." |
| String | Optional | This is either |
The HTML code for using the Games widget is given below. Click the “Run” button to display the fixtures.
We can change the data-date
(“YYYY-MM-DD”) in line 4 to see the fixtures for another date. We can also use the data-league
, data-team
, and data-season
tags to filter the fixtures list.
Note: The team ID can be retrieved using the Teams information endpoint, as explained in the Teams Information lesson, and the league ID can be retrieved using the Leagues endpoint, as explained in the Support Endpoints lesson in the Appendix.
View a single fixture
The Game widget displays the score, events, statistics, line-ups, and players’ statistics of a specific fixture. The data-id
tag dictates which fixture is displayed.
Game widget parameters
The following table contains the tags for the Game widget and their functionalities:
Tags | Type | Category | Description |
| String | Required | This is the hostname. It is |
| String | Required | This parameter specifies the API key that'll be used for request validation. |
| Integer | Optional | This is an integer corresponding to the number of seconds after which the list updates. It must be an integer greater than |
| String | Optional | This is the ID of the fixture we want to display. |
| Integer | Optional | This contains the league ID of the league we want to view the fixtures for. |
| String | Optional | This is used to specify the theme color that we want. If this field is left empty, the default theme will be applied; otherwise, the possible values are |
| String | Optional | This is either |
The code for the Game widget is given below. Click the “Run” button to get information for a fixture.
We will get the events, statistics, line-ups, and squads for the fixture. We can get information for other fixtures by changing the fixture ID in line 4.
Note: We can use the Fixtures endpoint to get the fixture ID, as explained in the Fixtures Information lesson.