Open ritteraf opened 6 years ago
Hi @ritteraf. The library is still currently a WIP, it doesn't do much of anything at the moment. I've attempted to hit the PUBG API a couple times, but it doesn't seem to be functioning correctly. Once it is, I'll resume development of this wrapper.
Oh so the PUBG API is still not fully functional? That's a bummer. Let me know if I can help in any way. I've seen you around in the Shopify Mobile Buy SDK - it would seem we have very similar interests :)
Every time I try and request a list of players filtered by username, it always gives me back an empty result set. I think anyone can register for an API key now, so maybe try it and see what you can find?
{"errors":[{"title":"Not Found","detail":"No players found matching criteria"}]}
Will do
Hey @cocoahero I finally got around to doing some of my own testing today. I was successfully able to grab the user data for my pubg account with the following swift code: `func attemptPubgIDLookup (playerName: String, completion: @escaping (String) -> Void) {
let region = "pc-na"
let urlString = "https://api.playbattlegrounds.com/shards/" + region + "/players?filter[playerNames]=" + playerName
let headers: HTTPHeaders = [
"Authorization": "Bearer \(pubgApiKey)",
"accept": "application/json"
]
Alamofire.request(urlString, method: .get, headers: headers)
.responseJSON { (response) in
debugPrint(response)
}
}`
Hmm, for whatever reason when searching for my player name, I don't get any results back. Can you paste what you get in the response?
[Request]: GET https://api.playbattlegrounds.com/shards/pc-na/players?filter%5BplayerNames%5D=AltenaBlue
[Response]: <NSHTTPURLResponse: 0x1cc031c20> { URL: https://api.playbattlegrounds.com/shards/pc-na/players?filter%5BplayerNames%5D=AltenaBlue } { Status Code: 200, Headers {
"Content-Encoding" = (
gzip
);
"Content-Length" = (
700
);
"Content-Type" = (
"application/json"
);
Date = (
"Mon, 09 Apr 2018 23:21:42 GMT"
);
Vary = (
"Accept-Encoding"
);
Via = (
"1.1 0a67f6cab5e0fc8020a30636dad56244.cloudfront.net (CloudFront)"
);
"x-amz-cf-id" = (
"uR6YsiT82vNBE8xUiEE4GQyP2JSdz19EHdMg8L4jK1g-umYwEIbCWg=="
);
"x-cache" = (
"Miss from cloudfront"
);
"x-ratelimit-limit" = (
10
);
"x-ratelimit-remaining" = (
9
);
"x-ratelimit-reset" = (
1523316162
);
"x-request-id" = (
"58caeaa2-35a5-4197-a478-cf0a76da16f2"
);
} }
[Data]: 1474 bytes
[Result]: SUCCESS: {
data = (
{
attributes = {
createdAt = "2018-04-05T14:36:25Z";
name = AltenaBlue;
patchVersion = "";
shardId = "pc-na";
stats = "
That's on my player name. We should pwn some noobs sometime ;)
Odd. Whenever I try my player name, or any of my friends, I don't get any data back. AltenaBlue
is the first I've seen that worked.
Are you sure you're setting the right region abbrevation? The docs don't say it, but I'm pretty sure you have to have played at least one game on the region server for it to work.
Yup, pc-na
. Try it for yourself, my player name is cocoahero
.
I'll try your username with my code if you hook me up
Yea, cocoahero, Cocoahero, and CocoaHero didn't return anything. I just tried it on one of my friends, and it worked as well. MaverickHS
Hmm, yeah I tried a different capitalization of one of my friends and it worked. Must be case-sensitive, which is annoying. Still haven't figured out what my capitalization is. =(
Yep. Definitely case sensitive. If you log into the game it shows you.
Well, apparently it is cocoahero
, but data wasn't showing up until I played a few rounds. /shrug
Yea, it seems the only real functionality of the user lookup is to get match ID's, which is a shame.
Hey cocoahero - thanks for the awesome PUBG API wrapper. Would it be possible for you to write a brief tutorial for using this library? I've gotten as far as adding the library via carthage, and all is working well there. I just have no idea what commands are now available to me after adding this library to access the PUBG API. If you don't have time to write a tutorial, could you just point me in the right direction for using it? Thanks!