(require '[pubg-clj.api :as pubg])
(def my-api-key "foo-bar")
(def player-name "Some_Player")
(def player-map
(pubg/with-api-key my-api-key
(pubg/fetch-player-by-name "steam" player-name)))
(pubg/with-api-key my-api-key
(pubg/fetch-player-season-stats player-map season-id))
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 a region variable during the url construction, while fetch-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.
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-urlwhich tries to concatenate aregionvariable during the url construction, whilefetch-player-season-statswill 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-urlwill 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]=falseI 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.