Bungie-net / api

Resources for the Bungie.net API
Other
1.22k stars 92 forks source link

Api responses empty list (Need help for new Py developer) #1540

Open Chanthebigbro opened 2 years ago

Chanthebigbro commented 2 years ago

I'm new developer and find way to get D2-guardian-activity-details from gd_info = requests.get(f"https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/-1/{GuardianName}/", headers = MY_API_KEY)

It show me error_code = 1. However, it returns empty list of Response. I tested few cases. print(gd_info.text) returns {"Response":[],"ErrorCode":1,"ThrottleSeconds":0,"ErrorStatus":"Success","Message":"Ok","MessageData":{}}

How can I deal with this issues? Hope you help me for deal with this problem.

P.S. I expected result like this { "Response": [ { "iconPath": "/img/theme/bungienet/icons/steamLogo.png", "crossSaveOverride": 0, "applicableMembershipTypes": [ 3 ], "isPublic": true, "membershipType": 3, "membershipId": "_IdNumber_", "displayName": "Someone", "bungieGlobalDisplayName": "Someone", "bungieGlobalDisplayNameCode": _Number_ } ], "ErrorCode": 1, "ThrottleSeconds": 0, "ErrorStatus": "Success", "Message": "Ok", "MessageData": {} }

joshhunt commented 2 years ago

Destiny2.SearchDestinyPlayer requires the full Bungie Name, including the bungieGlobalDisplayNameCode discriminator. Try /Platform/Destiny2/SearchDestinyPlayer/-1/joshhunt#664/

User.SearchByGlobalNamePrefix allows you to search by just the display name portion of the Bungie Name name. Try /Platform/User/Search/Prefix/joshhunt/0/

sdelu commented 2 years ago

For anyone new to this checking in the future, I had the same issue but was able to get a response for my own gamertag by changing to /platform/Destiny/SearchDestinyPlayer (note the /Destiny instead of /Destiny2). I get an empty response using the same gamertags/full bungie name using the /Destiny2 path.