No way to get the name(s) of a game from its ID?

So I’ve been thinking of using the ID of a game instead of its name, since the name can be changed, and it can have many different valid names.

I can’t find a way to get the name of a game if I only have the ID though, which makes the ID useless.

Any thoughts?

There isn’t any way to get the game by ID directly from the Twitch API. The roundabout way is to grab the GiantBomb ID and call their API for the game name. Our API is a reflection of GiantBomb including the names.

Best way we’ve been tracking it is to save the game name + twitch id in a table + a hash of the game name (though if you’re not managing a lot of data, just the name would be fine) - The twitch id is a primary key, so if the game id already exists in the db we update the game name and save the old game name to a historical table so we know that on such and such date, the game name changed from (x) to (y) – If the historical doesn’t matter to you, it’s safe to just replace the game name with the new one.

We also have a multi match table, because a game can also be mapped to multiple game names at the same time. Common typos and name variants seem to be the hotness there (IE: Dark souls III verse Dark Souls 3)

Ultimately the way we handle it is

Game ID exist? -> Yes -> Multi match table (Valid multi match?) -> No (Update) | Yes (Ignore)

Is this something that is being planned?

Yeah. Sadly, from what I’ve gathered, there are several (manually added) games and categories on Twitch that are not on GiantBomb, so that approach wouldn’t work 100% of the time.

In general, we don’t comment on future plans for the API. What would be the use case for this type of functionality? Are there common use cases where a game shows up and then the name changes drastically that search wouldn’t find it? Curious as to what got you thinking about this functionality and what can’t be solved with a solution like @tournymasterbotCurse suggested.

Yes, there are cases where the names of games change drastically. There’s also cases where a generic name or codename gets turned into an official name. Basically the games endpoint is kind of crazy :stuck_out_tongue:

My process basically noms a bunch of return results and applies logic to determine if two names are still active, and applies logic as to which of the two names are the ‘official’ name (/preferred name) - it also fades out old names over time. It’s quite a bit of logic for something that should be relatively straight forward.

Personally, I would LOVE it if all api endpoints supported a {apiurl}/by-id(s)/{id1},{id2},{id3} type of thing.

Also acceptable: ?ids={id1},{id2},{id3}

The problem with that solution is that I would basically be running my own replication of Twitch’s entire game database at that point, which is really not something I want to manage, nor should I really have to in my opinion.

It’s for storing a game via its ID so that the reference to it doesn’t vanish if/when the game’s title is updated/changed, which happens quite often.

Can confirm. But we needed the functionality, so we had to track it.

Can confirm this as well.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.