Back to API overview

League

Retrieve the list of leagues

Retrieves the list of leagues as an e.g. Dropdown object, given a season.

The result format is defined by the provided parameter format:

  • League list as dropdown: format is set to "dropdown".

Leagues with format "dropdown"

Definition

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

Takes:

format
e.g. "dropdown"
Format selector.
season
e.g. 2013
Season selector.

These fields are returned:

text
string
The name of the dropdown.
resource
array(object)
A list of header columns. Contains the text to display,
how it is aligned, and how wide it is.
entries
array(object)
Dropdown selections with set_in_content where league and game_class are set, and a textual representation of a league.
levels
array(string)
There is only one level, "Liga".
highlight
boolean
Always false.

Returns a structure of type dropdown:

{
  "type": "dropdown",
  "text": "League",
  "resource": "/leagues",
  "entries"=> [
    {"text"=>"Herren NLA",
     "set_in_context"=>{"league"=>1, "game_class"=>11},
     "entries"=>[],
     "highlight"=>true},
    {"text"=>"Damen NLA",
     "set_in_context"=>{"league"=>1, "game_class"=>21},
     "entries"=>[],
     "highlight"=>false},
    {"text"=>"Herren NLB",
     "set_in_context"=>{"league"=>2, "game_class"=>11},
     "entries"=>[],
     "highlight"=>false},
  ],
  "levels": ["League"],
  "highlight": false
}