Top Games returning N-1 results

When hitting the new API for top games getting an incorrect number of games returned. Seems to be n-1 requested after first is equal to 3 all the way up to 100.

$ curl -H “Authorization: Bearer ${TOKEN}” -s | jshon

“data”: [
“id”: “509658”,
“name”: “Just Chatting”,
“box_art_url”: “{width}x{height}.jpg
“id”: “491931”,
“name”: “Escape From Tarkov”,
“box_art_url”: “{width}x{height}.jpg
“pagination”: {
“cursor”: “eyJzIjozLCJkIjpmYWxzZSwidCI6dHJ1ZX0=”

I can’t replicate it here!

I get three

You still not getting the amount you are asking for?

Three working ok but now the number seems to be 11 returning 10

Taking off the first so the default of 20 is used is similarly returning 19.

Seems to be easier to replicate when using a high number like first=100

Hmm I wonder if the “missing game” is for “game is not set”

That’s correct. "game_id": "" is filtered out of the results of top games, but is done so after the results are returned from the database/cache, so if that game id is in the results range requested, it’ll get dropped and you’ll end up with first - 1 results.

This can be verified by using, paging through the results and summing the viewer count. The position where that game would be, if it was included, is consistent with where you start seeing a results returning fewer than the first param.

1 Like

Oh good catch, that explains why the result was moving as well at different times

Thanks for the tip, I’ll code around that idea or just always request n+1 since I can just drop the extra on my side if it isn’t needed at the time.

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