Like or dislike a video
const url = 'https://api.thebgdb.org/v1/games/5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77/videos/0b0f5a51-64a5-4f6b-9a39-0a4d6c5c0f11/vote';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"vote":"up"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.thebgdb.org/v1/games/5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77/videos/0b0f5a51-64a5-4f6b-9a39-0a4d6c5c0f11/vote \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "vote": "up" }'up likes the video, down dislikes it. One vote per member; voting again replaces it. Members cannot vote on what they added themselves. A vote that brings dislikes 3 or more ahead of likes, once at least 5 members have voted, hides the video (status becomes hidden) until a moderator shows it again or removes it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The game’s id, as returned in every game object. The game’s slug is accepted too, and so is an address it had before: a slug changed when the game was renamed by the addressing rule, or the id or slug of an entry merged into it because both were the same game. The answer is the game under its current id and slug; compare them with what you sent to update a stored link.
Example
5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77The video’s id.
Example
0b0f5a51-64a5-4f6b-9a39-0a4d6c5c0f11Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "vote": "up"}Responses
Section titled “Responses”The video’s counts after the vote.
object
object
Members who liked it.
Members who disliked it. Once dislikes outnumber likes by 3 or more, with at least 5 votes, it is hidden until a moderator looks at it.
hidden: voted down by members; no longer shown until a moderator looks at it.
Example
{ "data": { "likes": 4, "dislikes": 1, "status": "visible" }}vote is not “up” or “down”.
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"}The request has no valid session token.
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"}The video is the member’s own.
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"}No game has this id, or no such video is shown on it.
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"}