Skip to content

gamesRandom

GET /v1/games/random

This method returns a list of random games records. For official documentation of the endpoint, please refer to the MobyGames documentation.

Parameters

ParamsTypeRequiredDescription
queriesobjectOptionalSearch parameters to restrict the result
queries.limitstringOptionalThe maximum number of games to return
queries.formatstringOptionalThe output format (default id)

Examples

Without queries parameters

import { MobyGames } from '@untidy/mobygames';
const client = new MobyGames('access api key');
const data = await client.gamesRandom();
Successful response output
{
games: [58675, 3393, 10816, 15685, 3929],
};

Format and limit records in the response

import { MobyGames } from '@untidy/mobygames';
const client = new MobyGames('access api key');
const data = await client.gamesRandom({ format: 'brief', limit: '2' });
Successful response output
{
games: [
{ game_id: 58675, moby_url: 'https://www.mobygames.com/game/58675/forza-horizon/', title: 'Forza Horizon' },
{
game_id: 3393,
moby_url: 'https://www.mobygames.com/game/3393/the-legend-of-zelda/',
title: 'The Legend of Zelda',
},
],
};