Closed RudeySH closed 6 years ago
Just had the same issue with another game, "Krautscape" (appid: 268360). In the browser I see 23 results, but SteamKit is only returning 16 results. Again this only occurs using v2, v1 works fine.
Sorry for taking so long to get to this.
I can't reproduce the behaviour you're seeing. If this is still an issue, can you share example code?
I can't reproduce this anymore. I'll reopen this issue if I come across something similar again.
I have given it some thought and decided to reopen this issue. Right now, I'm having issues with v2 again that do not occur with v1. Unlike what happened before, this time it's not the result count that mismatches. Instead, I'm seeing percentages that are outdated, compared to the percentages v1 gives me. What's common between this and my earlier issues are: these are both caching issues.
I'm not really sure why this is happening. SteamKit probably just provides a simple wrapper that converts whatever Valve returns into those handy KeyValue
structures. It might very well be possible that the caching issues I'm experiencing are on Valve's end...
Anyone any ideas what is happening here?
I doubt SK2 has any say in this. I didn't see any caching header in the code that could affect the response that Valve's API returns. Why you won't check what values you get if you execute the request manually in your browser? That would tell you where the problem might be.
I should've mentioned that I already checked the requests in the browser. Both v1 and v2 return the same percentages. It's only when I'm requesting them through SteamKit, that I'm getting (seemingly) cached results. FYI, I'm using the same API key in browser and in my application.
The appid I'm having issues with right now is 578080. For example, "ACHIVE033" is 0.9% but using v2 through SteamKit gives me 0.4% (or 0.5%, can't remember exactly).
I thought Valve might be caching the results based on the IP address where the request is coming from. They might have somehow messed it up for GetGlobalAchievementPercentagesForApp/v2, I have no issues with any of the other endpoints.
Adding a cache buster instantly solved the problem for me, which proves the issue is on Steam's end, not SteamKit. Thanks @luchaos!
I'm using the following for all Steam API requests from now on: v: Guid.NewGuid()
.
I'm using the following for all Steam API requests from now on: v: Guid.NewGuid().
How does that work? I don't see it being documented anywhere.
It's not documented. Just append something unique to the request URL to make sure nothing is being cached on Steam's end, like &v=20180331
or &random_number
. To do this when using SteamKit, just add a random parameter to the dynamic function call. For example:
WebAPI.GetAsyncInterface("ISteamUserStats")
.GetGlobalAchievementPercentagesForApp2(gameid: 578080, v: DateTime.UtcNow)
I'm currently using Guid.NewGuid().ToString("N")
.
Interesting, thanks.
It seems SteamKit doesn't correctly parse the result of GetGlobalAchievementPercentagesForApp v2. For the game "Among the Sleep" (appid: 250620), I get 10 results when I call the API using my browser. However, the latest version of SteamKit is only giving me 4 results. This issue does not seem to occur when I use v1 of the API method.
https://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/?key=...&format=json&gameid=250620