originally posted in:BungieNetPlatform
I need help discerning if I have found a bug in the API or if I need to use a different approach for getting the member IDs for some display names.
The following endpoint is used to get a membership ID based on someone's display name and it works with some display names but not all:
https://www.bungie.net/Platform/Destiny/1/Stats/GetMembershipIdByDisplayName/['displayName']/
(This endpoint is setup for xbox but you can use it for PS names by changing the 1 to a 2)
The full response for a name that [i]doesn't[/i] work is:
[quote]{"Response":"0","ErrorCode":217,"ThrottleSeconds":0,"ErrorStatus":"UserCannotResolveCentralAccount",[b]"Message":"We've encountered an error, please try again later."[/b],"MessageData":{}}[/quote]
The full response for a name (my own is used here) that [i]does [/i]work is:
[quote]{"Response":"4611686018434033119","ErrorCode":1,"ThrottleSeconds":0,"ErrorStatus":"Success","Message":"Ok","MessageData":{}}[/quote]
I can go in my browser to a name that doesn't work and easily find their characters and their userID because it appears to be linked properly. For your own testing, if you're interested, here are six names that don't work:
[spoiler]TeamEllis
RexNusquam
Staley07
Sycawaytrooper
jmseyler433
docmo [/spoiler]
Finally, it's worth noting that I can find the userID for someone who doesn't even have a gamertag linked with their account, which makes me wonder what the error message means when they can't find a central account.
Any advice?
-
So, how you want to do this depends on your goal... are you looking to get Destiny Membership IDs using platform Gamertags? You can use the API for this, but you'll have to pass the right one - for example, looking at TeamEllis' profile, "TeamEllis" is their Bungie.net display name. Querying for GetMembershipByDisplayName with the Bungie.Net Platform Type (254) and "TeamEllis" will get you their Bungie.net membership ID. But to get his Destiny membership ID, you'd need to put in his platform name: which on XBox appears to be "Team Ellis 07". One way to get their Destiny Membership IDs if you only know their Bungie.net information is to query the GetBungieAccount endpoint: /Platform/User/GetBungieAccount/{membershipId}/254/ Pass in their Bungie.net membership ID and you'll get back basic information about every Destiny account attached to that Bungie.net account. This method is nice, if you already know their membership ID, because you get back meaningful Destiny information right away in that single call. Now, if you only know their Bungie.net display name, you could call: /Platform/Destiny/SearchDestinyPlayer/254/{displayName}/ And that should get you at least their membershipIds for every linked Destiny account, which you can then use to get more information from subsequent queries. I hope this helps!
-
Iirc, find by display name is searching for a bungie.net user, not an Xbox or psn user, and then returning the specified ID associated with the bungie ID. For instance, my bungie display name is Spartain_, whereas my gamer tag for Xbox is Spartain. If I try and search for Spartain, nothing will return, but if I specify that I want the Xbox gamer tag (flag 1) associated with the bungie display name Spartain_, it should return the correct value. Again this is just from what I remember off the top of my head, and can't verify it right now, but that may be good enough information to get you looking in the right direction. Also sorry for any grammar or formatting nasties. Typing on phone isn't fun.