Information API
Domains have an information API with which you can retrieve information about all active and upcoming games on the domain in JSON format. This is useful for developing third-party services that duplicate domain information to other places (Telegram, websites, etc.), and for a domain's own pages that draw their own game list.
Entry Point
api_games_list.php
Example request: https://game.qeng.org/api_games_list.php?v=2
Version
The GET parameter v selects which fields the answer carries.
- No
v— version 1: the answer the API has always returned, including the lists of teams (teams) and authors (authors). Old requests withjson=1get exactly this; it will not change, and thefieldsparameter is not read in it. v=2— everything exceptteamsandauthors. Those two lists take a separate database query per game and are not needed by everyone: leaving them out makes the answer noticeably cheaper and faster.
An unknown version number is treated as the latest known one, not as an error.
Choosing fields
The GET parameter fields lists, comma separated, exactly which fields you need. It works from v=2 on.
- The list defines the whole set, it is not added to the version's set.
- The
idfield is always there, you do not have to ask for it. - The order in the request does not matter — fields come back in their usual order.
- Unknown names are simply skipped, that is not an error.
Example: a domain's game list only needs the name, the time and the rating. https://game.qeng.org/api_games_list.php?v=2&fields=name,start_time_f,end_time_f,rating,me
Result Format
[{Game}, {Game}, ...]
Here Game is an object of the following type:
{ "id": 3287, /* Game ID */ "start_time": "2022-07-25 15:00:00", /* Game start time in human-readable format */ "end_time": "2022-07-27 15:00:00", /* Game end time in human-readable format */ "start_time_f": 1658750400, /* Game start time in unixtime format */ "end_time_f": 1658923200, /* Game end time in unixtime format */ "name": "QD10: Operation bolt or other adventures of gadget", /* Game name. Special characters in HTML entity format, e.g. " */ "type": 1, /* Game type: 0: Storm 1: Linear 2: Timer */ "kind": 1, /* Game kind: 0: other 1: green 2: yellow 3: red 4: virtual */ "single": false, /* Single-player or team game: false: Team game true: Single-player game */ "description": "PS: follow updates.<\/strong><\/p>\r\n", /* Game description */ "authors": [ /* List of authors. On request only: fields=authors */ { "uid": "2130", /* Player ID */ "username": "StelZ" /* Player username */ } ], "teams": [ /* List of teams that submitted requests for the game. For single-player games - list of players who submitted requests. On request only: fields=teams */ { "id": "201", /* Team ID */ "name": "911 Team", /* Team name */ "status": "0" /* Request status: "0": Applied "1": Accepted into the game "2": Accepted for test */ }, { "id": "200", "name": "Nostra sQuadra", "status": "0" }, ], "rating": { /* How players rated the game - the same number the reviews page shows. null if nobody has rated it yet. On request only: fields=rating */ "average": 4.5, /* Average rating in stars, from 0.5 to 5 */ "n": 12, /* How many players rated it */ "n_reviews": 3 /* How many of them wrote a review */ }, "me": { /* How the caller is doing in this game. null if they are not logged in or are not in this game. On request only: fields=me */ "team_id": 201, /* The last active team: the one they last played this game with. In a single-player game that is the player, and this is their ID */ "team_name": "911 Team", /* Its name, or the player's own name in a single-player game */ "score": 340, /* That team's points - the same sum the player sees inside the game, bonuses and penalties included. It can be negative */ "status": "playing" /* How far it has got: "playing": a task is in progress "finished": it was in the game, no task is left in progress "not_started": it applied but has not started the game yet */ } }
The me field is computed for whoever sent the request, so a domain page should ask for it with a plain fetch() to its own domain — then the browser sends the cookies along and the engine knows the player. An answer carrying this field must not be cached, and the engine sets the headers for that itself.
There is no “finished by time” state here: the list only returns games that have not ended yet.
Information Telegram Bot
You can also receive information about updates on the website using the Information Telegram bot.