Games - Get
Description
Gets game information by game ID or name.
You may get up to 100 categories or games by specifying their ID or name. You may specify all IDs, all names, or a combination of IDs and names. If you specify a combination of IDs and names, the total number of IDs and names must not exceed 100.
Method Definition
@RequestLine("GET /games?id={id}&name={name}&igdb_id={igdb_id}")
@Headers("Authorization: Bearer {token}")
HystrixCommand<GameList> getGames(
@Param("token") String authToken,
@Param("id") List<String> id,
@Param("name") List<String> name,
@Param("igdb_id") List<String> igdbId
);
Required Parameters (at least one)
Name | Type | Description |
---|---|---|
id | string | Game ID. At most 100 id values can be specified |
name | string | Game name. The name must be an exact match. For instance, “Pokemon” will not return a list of Pokemon games; instead, query the specific Pokemon game(s) in which you are interested. At most 100 name values can be specified. |
igdb_id | string | The IGDB ID of the game to get. Maximum: 100. The endpoint ignores duplicate and invalid IDs or IDs that weren’t found. |
Optional Parameters
Name | Type | Description |
---|---|---|
authToken | string | User or App Auth Token |
Code-Snippets
print game name
- Java
- Kotlin
- Groovy
GameList resultList = twitchClient.getHelix().getGames(Arrays.asList(overwatchGameId), null, null).execute();
resultList.getGames().forEach(game -> {
System.out.println("Game ID: " + game.getId() + " is " + game.getName());
});
val resultList = twitchClient.helix.getGames(listOf(overwatchGameId), null, null).execute()
resultList.games.forEach { game ->
println("Game ID: ${game.id} is ${game.name}")
}
def resultList = twitchClient.helix.getGames([overwatchGameId], null, null).execute()
resultList.games.each { game ->
System.out.println "Game ID: ${game.id} is ${game.name}"
}