Tournaments by Videogame

In this example, we will query for upcoming tournaments filtered to particular videogames and in ascending order for their start date/time. In others words, "Give me the next x upcoming tournaments for Videogame(s)." The first example will be for a single videogame, and the second example will be for an array of videogames.

For now, you can view the mapping of videogame IDs to their names in this sheet here.

Example #1 (Single Videogame)

  • Request
  • Response
query TournamentsByVideogame($perPage: Int!, $videogameId: ID!) {
tournaments(query: {
perPage: $perPage
page: 1
sortBy: "startAt asc"
filter: {
past: false
videogameIds: [
$videogameId
]
}
}) {
nodes {
id
name
slug
}
}
},
{
"perPage": 3,
"videogameId": 287
}

Example #2 (Array of Videogames)

  • Request
  • Response
query TournamentsByVideogames($perPage: Int, $videogameIds: [ID]) {
tournaments(query: {
perPage: $perPage
page: 1
sortBy: "startAt asc"
filter: {
upcoming: true
videogameIds: $videogameIds
}
}) {
nodes {
id
name
slug
}
}
},
{
"perPage": 3,
"videogameIds": [15, 24]
}