Steam API - Available stats when I don't own a game?

17 Views Asked by At

When fetching a users stats for a game from the steam API using:

url = f"http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/"
params = {
    'appid': self.appid,
    'key': apikey,
    'steamid': steamid
}
response = requests.get(url, params=params)

If the game isn't owned it returns None. However whether or not the game is owned I would like to be able to view the available stat names as I would like to display them. Is there any way to do this? Do I need to find an account with all games on? Thanks.

1

There are 1 best solutions below

0
jcjakec On

Found a simple solution - using the game schema endpoint instead returns stat names as well as their display names which is incredibly helpful, as well as some useful information.

def gameschema(appid):
    url = "http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/"
    params = {
        'appid': appid,
        'key': apikey
    }
    response = requests.get(url, params=params)
    return response.json()

This returns this (snippet):

This shows part of a response