steam

How to get the total playtime for specific steam app?


So far I read the documentation at https://partner.steamgames.com/doc/webapi/ISteamUserStats#GetGlobalStatsForGame and I got this:

GET https://api.steampowered.com/ISteamUserStats/GetGlobalStatsForGame/v1/?appid=779340&count=1&name[0]=TOTAL_PLAY_TIME&startdate=1567301084&enddate=1567381084

However, it returns

{"response":{"result":8,"error":"Stat 'TOTAL_PLAY_TIME' is not an aggregated stat"}}

How can I get the total playtime for any specific game/app on steam?

It should be possible, since sites like https://steamspy.com are able to display stats like the average playtime.


Solution

  • I never figured out if it is possible by only relying on the steam api. However for my use case it was sufficient to use the data https://steamspy.com provides. (Thanks @Fliere) Specifically I used the average_forever values, which can be queried via https://steamspy.com/api.php?request=appdetails&appid=779340. appid being the steam appid of the game you want to get the data on.