DestinyDevs / BungieNetPlatform

A community run wiki for the Bungie.net Platform APIs.
https://destinydevs.github.io/BungieNetPlatform/
MIT License
107 stars 12 forks source link

User.GetMembershipDataById does not return Battle.net displayName with # suffix #14

Open BinarMorker opened 6 years ago

BinarMorker commented 6 years ago

Calling this endpoint https://www.bungie.net/Platform/User/GetMembershipsById/{membershipId}/{membershipType}/ gives me the information I need, but only in the GeneralUser entity, not in the UserInfoCard. Since not every player has a GeneralUser entity linked to their Destiny account, it seems that there is no other way to get their correct displayName. For example, here is my date fetched from the API:

‌{  
   "response":{  
      "destinyMemberships":[  
         {  
            "iconPath":"\/img\/theme\/destiny\/icons\/icon_xbl.png",
            "membershipType":1,
            "membershipId":"4611686018430174205",
            "displayName":"BinarMorker"
         },
         {  
            "iconPath":"\/img\/theme\/destiny\/icons\/icon_psn.png",
            "membershipType":2,
            "membershipId":"4611686018434621158",
            "displayName":"BinarMorker"
         },
         {  
            "iconPath":"",
            "membershipType":4,
            "membershipId":"4611686018467210709",
            "displayName":"BinarMorker" // There should be a #1157 here
         }
      ],
      "bungieNetUser":{  
         "membershipId":"664856",
         "uniqueName":"BinarMorker",
         "displayName":"BinarMorker",
         "profilePicture":70632,
         "profileTheme":54,
         "userTitle":0,
         "successMessageFlags":"0",
         "isDeleted":false,
         "about":"Thine eyes, dipped in acid.",
         "firstAccess":"2010-01-03T05:23:59.987Z",
         "lastUpdate":"2018-06-04T01:43:16.268Z",
         "psnDisplayName":"BinarMorker",
         "xboxDisplayName":"BinarMorker",
         "showActivity":false,
         "locale":"en",
         "localeInheritDefault":true,
         "showGroupMessaging":true,
         "profilePicturePath":"\/img\/profile\/avatars\/bungie_day_15_45.jpg",
         "profileThemeName":"d2cover",
         "userTitleDisplay":"Newbie",
         "statusText":"",
         "statusDate":"2015-11-10T20:56:34.222Z",
         "blizzardDisplayName":"BinarMorker#1157" // A user without a Bungie account won't have this
      }
   },
   "errorCode":1,
   "throttleSeconds":0,
   "errorStatus":"Success",
   "message":"Ok",
   "messageData":{  

   }
}

Is this a bug or an oversight? It seems I should be able to access this data normally like for PSN and Xbox accounts, but the Battle.net handle is wrong here. Thanks for your time.

nine13tech commented 6 years ago

In game the #nnnnn does not show up. Since that is the destiny game account and not the blizzard account (though it is a destiny platform specific account) you want to pull from the bungieNetUserInfo section because that is the account that is authorized via the OAuth endpoint and thusly ties back to the blizzard servers. The displayName you see in the destinyUserInfo is the account and platform played within the game. This is the same for psn and Xbox. I have clan members that have different Xbox names than their bungie net account and destiny user info names.

BinarMorker commented 6 years ago

I understand that. However, if I have no bungieNetUserInfo linked to my Destiny profile, how can I get the full Battle.net gamertag?

nine13tech commented 6 years ago

You can't. It used to be you can run getAccount but that endpoint is now retired and because that data falls under privacy settings, it's protected. If your app has OAuth, you can use the getCurrentAccount to pull the protected data or you can run clan data vs bungieNet User Searches to "infer" the account. You can check the privacy settings for the account in the profile section:

{
    "Response": {
        "profile": {
            "data": {
                "userInfo": {
                    "membershipType": 1,
                    "membershipId": "4611686018441329538",
                    "displayName": "NinerOneThree"
                },
                "dateLastPlayed": "2018-07-28T17:20:55Z",
                "versionsOwned": 7,
                "characterIds": [
                    "2305843009267621982",
                    "2305843009267621983",
                    "2305843009267621984"
                ]
            },
            "privacy": 1
        },

"privacy": 1 See here for the possible values: https://bungie-net.github.io/multi/schema_Components-ComponentPrivacySetting.html#schema_Components-ComponentPrivacySetting

BinarMorker commented 6 years ago

My app does not have OAuth, but I remember being able to get the full Battle.net displayName in the UserCards in the past. There must be an update in the API that made this behavior change.

Thanks anyway!

nine13tech commented 6 years ago

Many changes - the link I gave you is the git hub maintained by bungie. you can check all of the stuff there and review the change logs. They swagger the API so all docs are autogenerated.

BinarMorker commented 6 years ago

Yes I know, I looked there first. I was just wondering if there was some kind of obscure parameter that made it appear, somewhere like in the supplementalDisplayName field or something (what does this field do anyway). There were many undocumented features back in Destiny 1, so I figured I'd ask :)