Skip to content

Competition

AndSte01 edited this page Mar 30, 2023 · 1 revision

Competition

Fields

field type meaning
id bigint the id of the competition
changed int unix timestamp since the last modification
name string the name of the competition
location string the location of the competition
date int unix timestamp of the date the competition takes place
feature_set int the feature set supported by the competition
areas int number of areas in the competition (might change over time)
live bool wether a competition is currently live or not

Api

getting competitions

make a GET request to /competition.

there are three different parameters for the request that influence the outcome:

parameter value meaning
id int > 0 the id of the competition you want to receive information about. Note: id overwrites all other behavior and always returns one or none competition (depends on wether an competition with that id exists or not)
limit 0 < int < 100 Optional. The amount of competitions shown per page (independent of pagination, maximum of 100 is automatically enforced, defaults to 100 if none is given.)
page 0 < int < number_of_pages The page of the competition list to view (if page is greater than number_of_pages the last page is shown)

All results are sorted by recent changes (the one with the most recent changes first). Parameters that are 0 get ignored.

case 1: no parameters given (limit is optional)

the first limit competitions ar shown (Note: limit defaults to 100 if none is given or greater than 100). Always returns an array (even with zero elements).

Result with limit = 1

[
  {
    "id": 9,
    "changed": 1680174701,
    "name": "Autem.",
    "location": "Et aut.",
    "date": 10454400,
    "feature_set": 0,
    "areas": 3,
    "live": false
  }
]

case 2: id is present and greater 0 (rest get's ignored)

The competition with the desired id is returned, if non exists an error is thrown.Note: id overwrites all other parameters. Always returns an single competition or error (no array).

Result with id = 1

{
  "id": 1,
  "changed": 1680174616,
  "name": "Veniam.",
  "location": "Ut.",
  "date": null,
  "feature_set": 0,
  "areas": 3,
  "live": false
}

case 3: page given

The result gets paginated and the competition for the desired page (page) are returned. Note the response is an array, with the first element being the total number of pages and the second element being an array of the competitions to display. Note: if page is greater than the number of pages, the last page is shown.

Result for page = 1, limit = 2

[
  5,
  [
    {
      "id": 9,
      "changed": 1680174701,
      "name": "Autem.",
      "location": "Et aut.",
      "date": 10454400,
      "feature_set": 0,
      "areas": 3,
      "live": false
    },
    {
      "id": 7,
      "changed": 1680174701,
      "name": "Quis.",
      "location": "Itaque.",
      "date": 649641600,
      "feature_set": 0,
      "areas": 0,
      "live": true
    }
  ]
]

And for the subsequent page = 2:

[
  5,
  [
    {
      "id": 8,
      "changed": 1680174701,
      "name": "Ipsam.",
      "location": "In.",
      "date": 1158710400,
      "feature_set": 0,
      "areas": 0,
      "live": true
    },
    {
      "id": 6,
      "changed": 1680174701,
      "name": "Nihil.",
      "location": "Nisi.",
      "date": 1028678400,
      "feature_set": 0,
      "areas": 3,
      "live": true
    }
  ]
]