Count games by first letter and by year
const url = 'https://api.thebgdb.org/v1/index/games/counts?lang=fr';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.thebgdb.org/v1/index/games/counts?lang=fr'The table of contents of the games index: how many names start with each letter, and how many games came out each year. Games whose year is unknown are in no year. With lang set to one of de, es, fr, it or pt (or a regional code of one), each game counts under the letter of its name in that language, as GET /index/games files it.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”A language code (BCP 47) such as “fr”, “ja” or “pt-BR”. A game that has a name in that language is returned with it as name, and its main name as originalName; a regional code falls back on its language (“fr-CA” on “fr”), a language with no name of its own takes a regional one (“pt” shows a name the game only has in “pt-BR”), and a game with no name in the language keeps its main name. A game that has a cover of its own in that language (the box of its French edition) is returned with it as image; otherwise image is its main cover. Only names and covers are localised: descriptions and summaries stay in English.
Example
frResponses
Section titled “Responses”The counts.
object
object
object
A to Z, or 0 for names that start with a digit or a sign. An accented letter counts as its plain letter.
object
Example
{ "data": { "letters": [ { "letter": "0", "games": 212 }, { "letter": "A", "games": 1340 } ], "years": [ { "year": 1995, "games": 210 }, { "year": 1996, "games": 198 } ] }}Over a request limit. rate_limited: without a token, 60 a minute and 2,000 a UTC day per address (more with a token; see Limits above). weekly_limit: the week’s requests or game details are used up (params.max is the cap). The retry-after header says how many seconds to wait: 60 for a minute’s limit, until midnight UTC for a day’s, until Monday 00:00 UTC for a week’s.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}