Open redbeardymcgee opened 2 years ago
After poking around the API docs some more, I found that the use of platform-region shards seems to be a legacy case for old seasons, and no other data.
The platform-region shard should be used for making requests for season stats for seasons before the Survival Title system was launched
https://documentation.pubg.com/en/making-requests.html#the-platform-shard
Requesting data with a platform-region shard appears to not fail with an error, but the API also does not respond with complete data, e.g. fetch-player-by-name
will return a player with an empty match samples vector.
I believe we can just remove this line and document the need for specifying a platform-region shard for legacy seasons.
I've tested this change a bit manually and am currently trying to learn how to run your tests instead.
The PUBG API will return a Bad Request error with the detail: "unknown data - shardId: steam-".
I believe this may be the fault of
api-url
which tries to concatenate aregion
variable during the url construction, whilefetch-player-season-stats
will always send at least the empty string as the region.Supplying a region also fails.
The problem seems to be a mixup between the platform shard and the platform-region shard, where this endpoint is expecting a platform shard. In a legacy case for seasons prior to the introduction of the Survival Title system, it would be "pc-na" to request season stats from the NA region for a PC player. I suspect this will also always fail because
api-url
will concat "steam-pc-na" or "steam-na" depending on how the client tries to pass the region.However, I think the url for seasons since the Survival Title system should simply be:
https://api.pubg.com/shards/**steam**/players/$account-id/seasons/$season-id?filter[gamepad]=false
I believe a rather large change was made a couple of years ago making leaderboards global, and the API accommodated this by implying the region from the platform shard. I could have mixed some things up.
You can verify here and read about it here.
While I think I found the source of the problem, I did not feel confident that I could fix it directly myself.