Bungie-net / api

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

characters missing emblemPath and emblemBackgroundPath #321

Closed afehners closed 6 years ago

afehners commented 6 years ago

I'm seeing some crashes for users where my app is unable to locate an emblemPath or emblemBackgroundPath for a users character(s).

I call /Platform/Destiny2/2/Profile/{membershipId}/ to get an array of characters. Most of the time I get everything back as expected, but I'm seeing for some users these items are missing. Are they suppose to always be there. I notice the emblemHash is always there, should I use that instead? are these other two properties not guaranteed to be there?

Example json for failure case:

{

"Response":{ "characters":{ "data":{ "2305843009315735529":{ "membershipId":"xxxxxxxxxxxxxxxxxxx", "membershipType":1, "characterId":"2305843009315735529", "dateLastPlayed":"2017-12-03T17:01:18Z", "minutesPlayedThisSession":"0", "minutesPlayedTotal":"0", "light":100, "stats":{ "3897883278":0, "144602215":0, "1735777505":0, "4244567218":0, "1935470627":100, "1885944937":10, "2996146975":1, "392767087":4, "1943323491":1, "3555269338":12 }, "raceHash":2803282938, "genderHash":3111576190, "classHash":3655393761, "raceType":1, "classType":0, "genderType":0, "emblemHash":2537840254, "levelProgression":{ "progressionHash":1716568313, "dailyProgress":0, "dailyLimit":4250, "weeklyProgress":0, "weeklyLimit":4250, "currentProgress":0, "level":1, "levelCap":8, "stepIndex":1, "progressToNextLevel":0, "nextLevelAt":4500 }, "baseCharacterLevel":1, "percentToNextLevel":0.0 }, "2305843009315735530":{ "membershipId":"xxxxxxxxxxxxxxxxxxx", "membershipType":1, "characterId":"2305843009315735530", "dateLastPlayed":"2017-12-03T17:01:18Z", "minutesPlayedThisSession":"0", "minutesPlayedTotal":"0", "light":100, "stats":{ "3897883278":0, "144602215":0, "1735777505":0, "4244567218":0, "1935470627":100, "1885944937":10, "2996146975":1, "392767087":4, "1943323491":1, "3555269338":12 }, "raceHash":2803282938, "genderHash":2204441813, "classHash":3655393761, "raceType":1, "classType":0, "genderType":1, "emblemHash":2537840254, "levelProgression":{ "progressionHash":1716568313, "dailyProgress":0, "dailyLimit":4250, "weeklyProgress":0, "weeklyLimit":4250, "currentProgress":0, "level":1, "levelCap":8, "stepIndex":1, "progressToNextLevel":0, "nextLevelAt":4500 }, "baseCharacterLevel":1, "percentToNextLevel":0.0 }, "2305843009315735531":{ "membershipId":"xxxxxxxxxxxxxxxxxxx", "membershipType":1, "characterId":"2305843009315735531", "dateLastPlayed":"2017-12-03T21:37:41Z", "minutesPlayedThisSession":"39", "minutesPlayedTotal":"236", "light":43, "stats":{ "3897883278":0, "144602215":0, "1735777505":0, "4244567218":0, "1935470627":43, "1885944937":43, "2996146975":5, "3555269338":103 }, "raceHash":3887404748, "genderHash":3111576190, "classHash":3655393761, "raceType":0, "classType":0, "genderType":0, "emblemHash":2537840254, "levelProgression":{ "progressionHash":1716568313, "dailyProgress":0, "dailyLimit":0, "weeklyProgress":0, "weeklyLimit":0, "currentProgress":13305, "level":4, "levelCap":8, "stepIndex":4, "progressToNextLevel":1805, "nextLevelAt":5000 }, "baseCharacterLevel":4, "percentToNextLevel":36.1 } }, "privacy":1 }, "itemComponents":{

  }

}, "ErrorCode":1, "ThrottleSeconds":0, "ErrorStatus":"Success", "Message":"Ok", "MessageData":{

} }

vthornheart-bng commented 6 years ago

Ah yes, you have run into the "Trial" emblems, which were redacted - though they should be un-redacted now. If for some reason we redact emblems in the future but people are able to get them, you could run into the same situation: my recommendation would be to make sure your application is able to fallback to a reasonable default if we don't return the emblemPath, as indeed it's not guaranteed that we will even have one to return you in this (hopefully rare) situation!