Data from the LHF database can be obtained in JSON using GET requests.
General hints
Whenever you see an icon like "</>" besides a table that's an URL to the same content in JSON.
The entities represented by "team" or "team_id" are actually clubs in recent (starting from 2022) uses. The entities represented by "squad"/"squad_id" are squads that are participating in a tournament. One team can have multiple squads in a single tournament.
Tournament standings
The tournaments themselves have no standings as they consist of multiple subtournaments (regular season and playoffs or group A, group B etc.).
The URI for subtournament standings is lhf.lv/api/json/team-stats?subtournament=id where ID is the subtournament identifier which you can find in the URL of the respective subtournament page.
You can start by looking up the tournament in the tournament list and opening it. If tournament has multiple subtournaments, you'll have to select the subtournament, otherwise you are forwarded directly to the only subtournament.
Example: https://lhf.lv/api/json/team-stats?subtournament=351
List of tournaments
List of tournaments and subtournaments is available at https://lhf.lv/api/json/tournaments.
Tournament schedule
Use https://lhf.lv/api/json/schedule?subtournament=id where ID should be used as described above.
Example: https://lhf.lv/api/json/schedule?subtournament=351.
Filtered by team: https://lhf.lv/api/json/schedule?subtournament=351&team=697.
Match
The score and team stats of a match can be found using https://lhf.lv/api/json/match?match=id, where ID can be found in the match URL or using the schedule API.
Example: score and team stats of match https://lhf.lv/en/match/9477 are here: https://lhf.lv/api/json/match?match=9477. The list of events is here: https://lhf.lv/api/json/events?match=9477. Rosters and staff lists are here: https://lhf.lv/api/json/rosters?match=9477.
Individual stats
For these an HTML format is available as well: lhf.lv/api/view/individual-stats?query.
The JSON is here: lhf.lv/api/json/individual-stats?query.
The query is assembled specifying some of the following parameters in the query string.
Parameter | Description | Possible values | Comments and examples |
---|---|---|---|
tournament | Tournament | Any tournament id. Can be a comma separated list. |
10 best scorers throughout six seasons: lhf.lv/api/view/individual-stats?tournament=44,13,41,86,73,148&limit=10 |
subtournament | Subtournament | ID of subtournament or comma separated list. | If you specify both tournaments and subtournaments, it's additive - the stats will be taken from every listed tournament and subtournament. |
match | Match | ID of match or comma separated list |
Goalie stats of match 9477: |
team | Team | Team id or comma separated list. | HK MOGO player stats: lhf.lv/api/view/individual-stats?subtournament=220&team=704&grouping=person&duty=1,2,3 |
person | Person | Person ID or comma separated list | It's mandatory to provide at least one of person, team, subtournament, tournament. |
birth-from birth-to |
Age limits. |
Date. Format: dd.mm.gggg. |
http://lhf.lv/en/api/view/individual-stats?grouping=person&subtournament=220&birth-from=01.01.2000. |
gender | Gender |
1 - male |
If person ID is specified, country, gender and age limits are ignored. |
country | Country | 1 - GBR,2 - GER,3 - FRA,4 - ITA, 5 - LIT,6 - CZE,7 - FIN,8 - BLR, 9 - JAP,10 - ROM,11 - SRB,12 - POL, 13 - UKR,14 - AUT,15 - NOR,16 - DEN, 17 - SLO,18 - EST,19 - LAT,20 - RUS, 21 - SWE,22 - SUI,23 - SVK,24 - ASV, 25 - EST,26 - CAN,27 - ITA,28 - KAZ, 29 - SLO |
If person ID is specified, country, gender and age limits are ignored. |
duty | Position/duty | 1 - forward; 2 - defenceman; 3 - goalie 5,9 - referee; 6,16 - registrator; 7,8 - penalty time referee; 10 - secretary 11,14 - linesman; 12 - timekeeper; 13,15 - goal judge; 17 - informant; 18 - online operator; 19 - doctor 20 - head coach; 21 - coach; 22 - team manager; 23 - team doctor; 24 - equipment manager; 25 - team manager; 26 - inspector; 27 - stand-by referee |
Defencemen stats: http://lhf.lv/en/api/view/individual-stats?duty=2&subtournament=220&grouping=person |
match-from match-to |
Datumu limits for matches | Date. Format: dd.mm.gggg. |
lhf.lv/en/api/view/individual-stats?subtournament=220&match-from=01.01.2017.&match-to=31.01.2017.&limit=5 |
values | Rādāmo vērtību komplekts | field-player-stats goalie-stats roster staff-work |
Default is field-player-stats match-from, match-to and grouping are ignored if values=roster |
grouping | Grupēšana |
person - total player stats (as opposed to game-by-game stats)
|
http://lhf.lv/en/api/view/individual-stats?subtournament=220&values=staff-work&person=167,3335&grouping=person,duty |
sorting | Sorting | if values=field-player-stats points, goals, assists, matches, number if values=goalie-stats time_on_ice, matches, matches_appeared, shutouts, number if values=staff-work matches, duty, match_id if values=roster duty, number |
The first out of listed is the default |
limit | Number of rows to show | Any positive integer |
Beware that your requests maybe logged and/or throttled.
If you have suggestions or stumble upon mistakes, please contact LHF and website maintainers.