Skip to main content

Endpoints

The complete reference with all fields is the Swagger UI of your installation at /api/docs (the OpenAPI description is at /api/docs/openapi.json). This page gives an overview and the rules that are worth knowing.

Conventions​

  • All paths start with /api/v1.

  • All answers are JSON, the content is in data.

  • Errors have a message, and invalid input also has errors:

    {"message": "The home goals field must be present.", "errors": {"home_goals": ["The home goals field must be present."]}}
  • Users in answers contain only id and the display name the website shows, never email addresses.

Overview​

MethodPathPurpose
GET/leaguesAll leagues made available by the administrator
GET/leagues/{league}/seasonsSeasons of a league
GET/seasons/{season}/matchdaysMatchdays and rounds of a season (key is the identifier below)
GET/seasons/{season}/matchdays/{matchday}One matchday/round with its games
GET/seasons/{season}/matchdays/{matchday}/tipsYour own tips with points
GET/seasons/{season}/matchdays/{matchday}/overviewTip overview: tips of all users and distribution
GET/seasons/{season}/ranking?from=&to=Single ranking of a season, optionally between two matchdays
GET/leagues/{league}/ranking/all-timeAll-time ranking of a league
PUT/games/{game}/tipCreate or change your tip, both values null delete it
DELETE/games/{game}/tipDelete your tip
GET/seasons/{season}/bonus-questionsBonus questions of a season with your answers
GET/bonus-questions/{bonus}One bonus question with your answers
GET/bonus-questions/{bonus}/clubs?search=Clubs/countries which can be chosen for a question
GET/bonus-questions/{bonus}/players?club=&search=Players of a club which can be chosen (questions of type player)
PUT/bonus-questions/{bonus}/answersSet your answers, an empty list deletes them
DELETE/bonus-questions/{bonus}/answersDelete your answers

{matchday} is a key of the matchday list, for example matchday_5 or round_12-13, exactly like on the website.

Example: placing a tip​

KEY="xtk_..."
API="https://your-site/api/v1"

# 1. Leagues, then the seasons of one of them
curl -H "Authorization: Bearer $KEY" "$API/leagues"
curl -H "Authorization: Bearer $KEY" "$API/leagues/1/seasons"

# 2. Matchdays of a season, then the games of one matchday
curl -H "Authorization: Bearer $KEY" "$API/seasons/12/matchdays"
curl -H "Authorization: Bearer $KEY" "$API/seasons/12/matchdays/matchday_5"

# 3. Tip a game
curl -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"home_goals": 2, "guest_goals": 1}' "$API/games/345/tip"

Rules worth knowing​

Leagues​

Only the leagues in the setting "available leagues" of xTIPP can be used. Other leagues, their seasons and their games answer 404, as if they did not exist.

Hidden pages​

An endpoint answers 403 when the administrator has hidden the matching page of the website for the user. Like on the website, only the page itself counts, not its parent menu entry:

EndpointPage
matchdays, one matchdaytipping, tip overview or single ranking (at least one)
own tips, PUT/DELETE tiptipping (/tippen)
bonus questions, clubs, players, PUT/DELETE answersbonus (/tippen/bonus)
overviewtip overview (/tippen/uebersicht)
ranking of a seasonsingle ranking (/rangliste)
all-time rankingall-time ranking (/rangliste/ewige-rangliste)

Tips​

  • The body is {"home_goals": 2, "guest_goals": 1}. Both null delete the tip.
  • PUT can be repeated safely.
  • A game which started or reached its deadline answers 409.
  • The same rules as on the tip page apply, for example no draw tips for knockout games when the extra time counts, and the email confirmation is sent.

Tip overview​

  • Like on the website, the tips of other users are only listed when the deadline of the game is reached (tips_visible), whatever the status of the game is. Before, only your own tip is returned.
  • The distribution (allocation) follows the settings of the administrator for the tip overview, and is null when the website would not show it.

Rankings​

  • Users with equal values share a place, and the next place is skipped (1, 1, 3).
  • current_matchday_points are the points at the last played matchday/round of the selection (null if nothing of the selection has been played).
  • place_change is the change of the place by this matchday: positive means places gained, null if nothing was played before.

Bonus questions​

  • An answer is the id of a club (type club) or of a player (type player). Find them with the clubs and players endpoints.
  • PUT with {"answers": [7, 12]} replaces all your answers of the question. To add one, send the given answers plus the new one. To remove one, send the list without it. An empty list deletes all answers.
  • PUT can be repeated safely. The points depend on the time of the answer, so an answer which is sent again keeps its time, like on the website.
  • Every answer counts only once. An answer stored twice (for example by an old import) is listed once, and the extra row is removed with the next PUT.
  • Answers are possible until the last deadline of the question (points[].until), afterwards 409.
  • The answers of other users (bonus overview) are not part of the API.