Suggest games while someone types
const url = 'https://api.thebgdb.org/v1/suggest?q=wingsp&limit=8&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/suggest?q=wingsp&limit=8&lang=fr'What a search box should offer for what has been typed so far: games, and up to 3 designers, artists or publishers (TermResult, told apart by their kind) found as by GET /search?type=all. A person or publisher whose name matches better than the best game comes first (feld: Stefan Feld before a game whose name merely starts with Feld); the others come after the first game. Games: the same matching and order as GET /search, misspellings included, in a slimmer answer (no ratings, no cover judgement) read in one step from the search index, so it answers in a few milliseconds. thumbnail is our small copy of the game’s main cover. Answers are cached for everyone alike until the catalog changes, keyed by the query with case, accents and punctuation removed; a cached answer does not count against the rate limits.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”What has been typed so far.
Example
wingspA 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”Suggestions, best first; approximate ones last.
object
object
The game’s name in lang when it has one, else its main name.
The main name, when name is another.
object
Path of our small copy of the main cover, under this API’s address; null when we hold none.
The name the query was found in, when it is neither name nor originalName.
object
True when found by correcting the spelling of the query.
A designer, artist or publisher found by name. Its page on this API is /designers/{slug}, /artists/{slug} or /publishers/{slug}.
object
Its own name.
The spelling found when it is one merged into this term (“Ouset Media” for Ouset); null when its own name was found.
Example
{ "query": "colons de", "data": [ { "id": "5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77", "slug": "catan", "name": "Catan", "originalName": null, "kind": "game", "yearPublished": 1995, "players": { "min": 3, "max": 4 }, "thumbnail": "/v1/media/covers/abababababababababababababababababababababababababababababababab-small.webp", "matchedName": { "name": "Les Colons de Catane", "language": "fr" }, "approximate": false } ]}q is shorter than 2 or longer than 100 characters, or lang is not a language code.
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"}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"}