Back to API overview

Game

Retrieve a list of (current) games

Retrieves a list of games as a simple JSON object.

There are several distinct table configurations:

  • A list of games with detail information (navigable via league).
  • A list of recent games of two teams (navigable via a game id).
  • A list of cup games for a given round (navigable via a round id).
  • A list of games for a given session (not navigable).
  • A list of current games (navigable via date).
  • A list of games for a season and a club (navigable via list pages).

Which results are returned is defined by the provided parameter mode:

  • Cup games for a round: mode is set to "cup".
  • Current games: mode is set to "current".
  • Direct meetings of two teams: mode is set to "direct".
  • Next games for all favorites: mode is set to "favorite".
  • Overview list: mode is set to "list".
  • Club list: mode is set to "club".
  • Team list: mode is set to "team".

Cup games

Definition

GET https://api-v2.swissunihockey.ch/api/games

Takes:

mode
should be "cup"
Mode selector.
tournament_id
string
A tournament id. Uses that id to find the requested tournament.
round
string
A round id. Uses that id to find the requested round.
side
one of {left, right}
Either left or right. Format the data for the left or right side of a cup view request.

These fields are returned:

context
object
The current context (which on_date - the currently shown date - it displays).
title
string
The title of the table, corresponding to the name of the cup
headers
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
regions
array(object)
Table regions with table data. Each region in a left-side request contains
a pair of games, whose winners compete in a game in a later round.
A right-side request returns a single region with a list of games.
Games order between left-side regions and right-side games is guaranteed
consistent.

Sample Response: left

Sample Response: right

Current games

Definition

GET https://api-v2.swissunihockey.ch/api/games

Arguments are:

mode
should be "current"
Mode selector.
league_ids
string
Optional. Comma separated list of league ids.
E.g. if you want to filter for just NLA and NLB, provide league_ids=1,2
game_class_ids
string
Optional. Comma separated list of game class ids.
tournament_ids
string
Optional. Comma separated list of tournament ids. Use this to filter for cups.
only_video_streamed
bool
Optional, defaults to false. Display only games where a video stream
is available if set to true.

A note about filtering: If you provide

  • None of game_class_ids, league_ids, tournament_ids, all matching games will be shown.
  • Only game_class_ids, league_ids or both, no cup games will be shown.
  • Only tournament_ids, only cup games will be shown
  • All of game_class_ids, league_ids, tournament_ids
    • Cup games matching the tournament_ids will be shown
    • Non-cup games matching game_class_ids and league_ids will be shown.

These fields are returned:

context
object
The current context (which on_date - the currently shown date - it displays).
title
string
The title of the table Aktuelle Spiele
headers
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
slider
object
A slider text with prev/next link (previous game day/next game day).
regions
array(object)
Table regions with table data. Each region is a separate league.

Sample Response

Direct meetings of two teams

Definition

GET https://api-v2.swissunihockey.ch/api/games

Takes:

mode
should be "direct"
Mode selector.
game_id
string
A game id. Uses that id to find recent games of the two teams playing in that game.
amount
integer
Maximum number of games to return.

These fields are returned:

context
object
The current context.
title
string
The title of the table Direktbegegnungen
headers
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
regions
array(object)
One table region with table data.

Sample Response

Favorite games

Definition

GET https://api-v2.swissunihockey.ch/api/games

Displays the next game for each of the favorites in session identified by sid. If a date is passed in on_date, that date is considered as starting point, otherwise the default of the request time will apply.

Takes:

mode
should be "favorite"
Mode selector.
sid
string
The id of the session where the favorites have been added.
on_date
date
A date of interest, defaulting to the current date. In the form 'YYYY-MM-DD', ie: "2013-12-31".
mode
string "favorite"
Needs to be set to the string "favorite".

These fields are returned:

context
object
The current context (which on_date - the currently shown date - it displays).
title
string
The title of the table ("Favorite")
headers
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
regions
array(object)
Table regions with table data. Each region contains one game referring to a favorite.

Overview list

Definition

GET https://api-v2.swissunihockey.ch/api/games

Returns an overview over the current games in a given league. Several methods of retrieving such a list are supported:

  • Using mode=list only. Defaults to display of NLA gentlemen. Use the dropdown to navigate further.
  • Using a combination of mode=list, league, game_class and season, displays the selected combination. This is also what should happen when users select from the drop down.
  • Using a combination of mode=list, team_id and season. Will display the league and group the team was in the given season.
  • Using a combination of mode=list, player_id and season. Will display the league and group the player was in the given season.

View options are: * view: short or full (default). Short shows reduced result entries.

Arguments are:

mode
should be "list"
Mode selector.
season
integer
Identifies the season to display, use for example 2013 to display season 13/14.
league
integer
League to display.
game_class
integer
Game class to display.
group
string or empty
Chooses the group to display. Defaults to the first group in the tournament.
team_id
integer
Selects league, game_class and group according to the teams participation in the given season.
player_id
integer
Selects league, game_class and group according to the players participation in the given season.
use_streaming_logos
boolean
Defaults to false. Returns logos in bigger format suitable for streaming purposes if set to true.

The list returned will display the currently played round or the last round of the tournament.

These fields are returned:

context
object
The current context.
title
string
The title of the table, i.e. the name of the season.
headers
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
slider
object
A slider text with prev/next link (previous game day/next game day).
regions
array(object)
Table regions with table data. Each region is a separate league.

Sample Response

Club games

Definition

GET https://api-v2.swissunihockey.ch/api/games

Displays all games for a given club (by club_id) for a given season in a list. The list is navigable by means of the header slider links which will display 'prev' or 'next', according to circumstances.

The list is in order of occurrence of these games. If two games occur on the same date, they are ordered by internal index. Using the sort options defined on the 'Liga/Gruppe'-header, you can sort by league and group as first criterion. Inside of these groups, order will be chronological ascending.

Each row of the list contains a link to the game detail (type: "page", page: "game_detail"). The league/group column contains a link to the league/group detail page (type: "page", page: "league_group_detail"); ids are (in order): season, league, game_class, group. The last column giving the gym location has a google maps link attached to it.

mode
should be "club"
Mode selector.
club_id
integer
ID of the club to display a game list for.
season
integer
Season to display.

Sample Response

Team games

Definition

GET https://api-v2.swissunihockey.ch/api/games

Displays all games for a given team (by team_id) for a given season in a list. The list is navigable by means of the header slider links which will display 'prev' or 'next', according to circumstances.

The list is in order of occurrence of these games. If two games occur on the same date, they are ordered by internal index.

Each row of the list contains a link to the game detail (type: "page", page: "game_detail"). Ids are (in order): season, league, game_class, group. The second column giving the gym location has a google maps link attached to it.

mode
should be "team"
Mode selector.
team_id
integer
ID of the team to display a game list for.
season
integer
Season to display.

Sample Response

Lineup for a Team (during the game)

Definition

GET https://api-v2.swissunihockey.ch/api/games/:game_id/teams/:is_home/players

Returns the lineup for a game as a TABLE object.

The following parameters must be given:

game_id
string
unique identifier for the game, obtained through other means
is_home
integer
0 returns the lineup for the home team, 1 for the away team

The following parameters are optional:

view
string
choose between complete data ("full") and a shorter version ("short")
hide_empty
boolean
default: true. if lineup is unknown, when true returns a blank response, when false returns an empty table

Sample Response

Game details

Definition

GET https://api-v2.swissunihockey.ch/api/games/:game_id

Returns the details for the game as a attribute_list object.

The following parameters must be given:

game_id
string
unique identifier for the game, obtained through other means

These fields are returned:

home_logo
url
link to logo of home team
home_name
string
name of the home team
away_logo
url
link to logo of away team
away_name
string
name of the away team
result
string
result of the match
date
string
date of the match
time
string
starting time for the match
location
map
coordinates of game location
first_referee
string
name of the first referee - displayed not earlier than 48h
before thegame starts
second_referee
string
name of the second referee - displayed not earlier than 48h
before thegame starts
spectators
string
number of spectators present (if available)

Sample Response

Game Summary

Definition

GET https://api-v2.swissunihockey.ch/api/games/:game_id/summary

Returns a textual summary of the game as an attribute list. The following attributes will be defined:

title
string
title
subtitle
string
subtitle
text
list
a number of paragraphs that describes the game

Sample Response