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 haserrors:{"message": "The home goals field must be present.", "errors": {"home_goals": ["The home goals field must be present."]}} -
Users in answers contain only
idand the display name the website shows, never email addresses.
Overview
| Method | Path | Purpose |
|---|---|---|
| GET | /leagues | All leagues made available by the administrator |
| GET | /leagues/{league}/seasons | Seasons of a league |
| GET | /seasons/{season}/matchdays | Matchdays 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}/tips | Your own tips with points |
| GET | /seasons/{season}/matchdays/{matchday}/overview | Tip 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-time | All-time ranking of a league |
| PUT | /games/{game}/tip | Create or change your tip, both values null delete it |
| DELETE | /games/{game}/tip | Delete your tip |
| GET | /seasons/{season}/bonus-questions | Bonus 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}/answers | Set your answers, an empty list deletes them |
| DELETE | /bonus-questions/{bonus}/answers | Delete 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:
| Endpoint | Page |
|---|---|
| matchdays, one matchday | tipping, tip overview or single ranking (at least one) |
own tips, PUT/DELETE tip | tipping (/tippen) |
bonus questions, clubs, players, PUT/DELETE answers | bonus (/tippen/bonus) |
| overview | tip overview (/tippen/uebersicht) |
| ranking of a season | single ranking (/rangliste) |
| all-time ranking | all-time ranking (/rangliste/ewige-rangliste) |
Tips
- The body is
{"home_goals": 2, "guest_goals": 1}. Bothnulldelete the tip. PUTcan 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 isnullwhen 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_pointsare the points at the last played matchday/round of the selection (nullif nothing of the selection has been played).place_changeis the change of the place by this matchday: positive means places gained,nullif nothing was played before.
Bonus questions
- An answer is the id of a club (type
club) or of a player (typeplayer). Find them with theclubsandplayersendpoints. PUTwith{"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.PUTcan 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), afterwards409. - The answers of other users (bonus overview) are not part of the API.