Bungie-net / api

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

SearchDestinyPlayer returns multiple results #1556

Closed landervervaeke closed 2 years ago

landervervaeke commented 2 years ago

Hello,

I'm trying to search for the user with Bungie name dysfunctionlfox#2833.

Therefore I'm calling the following endpoint: https://stats.bungie.net/Platform/Destiny2/SearchDestinyPlayer/All/dysfunctionlfox%232833/.

Which returns the following:

array:2 [
  0 => array:9 [
    "iconPath" => "/img/theme/bungienet/icons/xboxLiveLogo.png"
    "crossSaveOverride" => 0
    "applicableMembershipTypes" => array:1 [
      0 => 1
    ]
    "isPublic" => true
    "membershipType" => 1
    "membershipId" => "4611686018459403956"
    "displayName" => "Epirephintea"
    "bungieGlobalDisplayName" => "dysfunctionlfox"
    "bungieGlobalDisplayNameCode" => 2833
  ]
  1 => array:9 [
    "iconPath" => "/img/theme/bungienet/icons/psnLogo.png"
    "crossSaveOverride" => 0
    "applicableMembershipTypes" => array:1 [
      0 => 2
    ]
    "isPublic" => true
    "membershipType" => 2
    "membershipId" => "4611686018465680239"
    "displayName" => "dysfunctionlfox"
    "bungieGlobalDisplayName" => "dysfunctionlfox"
    "bungieGlobalDisplayNameCode" => 2833
  ]
]

My problem is that both results have a different membershipId and I'm not sure which one I need to pick. In this particular case the second result seems to be the correct one, but I don't know how to check this. I could try them both in a second api call, but I hope there is a better method.

Thanks!

Cheers, Lander

mikechambers commented 2 years ago

I am pretty sure this is the same as https://github.com/Bungie-net/api/issues/1538

If you want to see an example of how to handle this (in Rust) and find which one to use (I use last played), see:

https://github.com/mikechambers/dcli/blob/df2317e731b57db8a08a7575034c85383df8ef27/src/dcli/src/apiinterface.rs#L129

jshaffstall-bng commented 2 years ago

This looks like it's working as expected. Just two linked destiny accounts with a shared Bungie Name.