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.

You can find the ID for a given game via the instructions in the get game id by name example query.

Example #1 (Single Videogame)

  • Request
  • Response
query TournamentsByVideogame($perPage: Int!, $videogameId: ID!) {
tournaments(query: {
perPage: $perPage
page: 1
sortBy: "tournament.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: "tournament.startAt asc"
filter: {
upcoming: true
videogameIds: $videogameIds
}
}) {
nodes {
id
name
slug
}
}
},
{
"perPage": 3,
"videogameIds": [15, 24]
}