I didn't see race / gender info in the API, I thought it be neat to see what the breakdown of the community was similar to this D&D chart on fivethirtyeight.
Thanks.
Hi queuebit,
You can definitely pull race and gender from the API and even character models (a lot more advanced) if you so choose. You can find the endpoints and documentation located here BUNGIE.NET API. One important note though is when getting character data this is on a per character basis and there is no aggregated data that I aware of like in the link you referenced.
Usually when I want to to get a users I do so based off of there display name. Two important pieces of information that you will need in order to retrieve a players character race and gender is the BungieMembershipType and the membershipId. If you want more detailed information on the character you will also need the characterId.
You will want to use the following endpoints to get at the data you want if you are looking up say a friends character based on what I just described above.
/Destiny2/SearchDestinyPlayer/{membershipType}/{displayName}/ documentationExample: /Destiny2/SearchDestinyPlayer/1/xlx%20CLU%20xlx/
This returns an array of User.UserInfoCard. In this case you can see I searched for an xbox user since I supplied 1 for the membershipType and 'xlx CLU xlx' for the displayName.
{
"Response":[
{
"iconPath":"/img/theme/destiny/icons/icon_xbl.png",
"membershipType":1,
"membershipId":"4611686018429681104",
"displayName":"xlx CLU xlx"
}
],
"ErrorCode":1,
"ThrottleSeconds":0,
"ErrorStatus":"Success",
"Message":"Ok",
"MessageData":{
}
}
We now know the two pieces of information we need to get the 'xlx CLU xlx' character data that we care about (race and gender). We have the membershipType and membershipId.
/Destiny2/{membershipType}/Profile/{destinyMembershipId}/ documentationExample: /Destiny2/1/Profile/4611686018429681104/?components=200
This returns a Destiny.Responses.DestinyProfileResponse which has a ton of cool stuff you can get at. You will notice in the above example endpoint I specified ?components=200. This can actually be a comma separated list that allows you to specify multiple components that you want to get and can access based on a users privacy settings. You can read more about Destiny.DestinyComponentType which is a cool new way in the Destiny 2 API to get at data you want.
This gives a response of the following (truncated for example):
{
"Response":{
"characters":{
"data":{
"2305843009278040164":{
"membershipId":"4611686018429681104",
"membershipType":1,
"characterId":"2305843009278040164",
"dateLastPlayed":"2017-10-13T03:34:25Z",
"minutesPlayedThisSession":"133",
"minutesPlayedTotal":"3299",
"light":304,
"stats":{
"144602215":0,
"392767087":5,
"1735777505":0,
"1885944937":299,
"1935470627":304,
"1943323491":5,
"2715839340":20,
"2996146975":3,
"3555269338":59,
"3897883278":0,
"4244567218":0
},
"raceHash":3887404748,
"genderHash":2204441813,
"classHash":3655393761,
"raceType":0,
"classType":0,
"genderType":1,
"emblemPath":"/common/destiny2_content/icons/5d3efc84979a5ead9e5b2564095ed5cd.jpg",
"emblemBackgroundPath":"/common/destiny2_content/icons/b6b06d21b15083d353be98ef714158a1.jpg",
"emblemHash":3257147585,
"levelProgression":{
"progressionHash":1716568313,
"dailyProgress":0,
"dailyLimit":0,
"weeklyProgress":0,
"weeklyLimit":0,
"currentProgress":146000,
"level":20,
"levelCap":20,
"stepIndex":20,
"progressToNextLevel":0,
"nextLevelAt":0
},
"baseCharacterLevel":20,
"percentToNextLevel":0
},
}
"privacy":1
},
"itemComponents":{
}
},
"ErrorCode":1,
"ThrottleSeconds":0,
"ErrorStatus":"Success",
"Message":"Ok",
"MessageData":{
}
}
You will notice that now have two pieces of the information you are looking for, The raceHash and the genderHash.
Most data is returned as a hash when there is more bountiful information that is tied to it. You can get this extended information by querying a manifest which is a database you can download that is in SQLite format. You can get the manifest from here /Destiny2/Manifest/ which will reduce your calls you need to make to the endpoints (this is a whole other topic though in regards to downloading and reading the manifest). I am not sure if the endpoint /Destiny2/Manifest/{entityType}/{hashIdentifier}/ can be used to get race and gender information? I tried with the DestinyEntitiesCharactersDestinyCharacterComponent and raceHash but got no results. This enpoint is still also in preview mode I believe which means it may not be complete so the manifest is your best bet unless someone knows and endpoiint you can hit now.
If you look up my raceHash in the manifest database you will see that I am a human and my genderHash is female.
I realize that this a lot of information if you have never used the API before but I hope this can at least get you started in the right direction to querying some data and seeing how the different endpoints and manifest all come together to serve up a lot of powerful information.
@queuebit from this most recent week of trials
https://docs.google.com/spreadsheets/d/1bnTolbx5VF-uoK0f0Zwb7I8Lb3OQm8L145ifc8MzUAk/edit?usp=sharing
Thanks @v-fedorov and @xlxCLUxlx !
Most helpful comment
Hi queuebit,
You can definitely pull race and gender from the API and even character models (a lot more advanced) if you so choose. You can find the endpoints and documentation located here BUNGIE.NET API. One important note though is when getting character data this is on a per character basis and there is no aggregated data that I aware of like in the link you referenced.
Usually when I want to to get a users I do so based off of there display name. Two important pieces of information that you will need in order to retrieve a players character race and gender is the BungieMembershipType and the membershipId. If you want more detailed information on the character you will also need the characterId.
You will want to use the following endpoints to get at the data you want if you are looking up say a friends character based on what I just described above.
/Destiny2/SearchDestinyPlayer/{membershipType}/{displayName}/documentationExample:
/Destiny2/SearchDestinyPlayer/1/xlx%20CLU%20xlx/This returns an array of User.UserInfoCard. In this case you can see I searched for an xbox user since I supplied 1 for the membershipType and 'xlx CLU xlx' for the displayName.
We now know the two pieces of information we need to get the 'xlx CLU xlx' character data that we care about (race and gender). We have the membershipType and membershipId.
/Destiny2/{membershipType}/Profile/{destinyMembershipId}/documentationExample:
/Destiny2/1/Profile/4611686018429681104/?components=200This returns a Destiny.Responses.DestinyProfileResponse which has a ton of cool stuff you can get at. You will notice in the above example endpoint I specified
?components=200. This can actually be a comma separated list that allows you to specify multiple components that you want to get and can access based on a users privacy settings. You can read more about Destiny.DestinyComponentType which is a cool new way in the Destiny 2 API to get at data you want.This gives a response of the following (truncated for example):
You will notice that now have two pieces of the information you are looking for, The
raceHashand thegenderHash.Most data is returned as a hash when there is more bountiful information that is tied to it. You can get this extended information by querying a manifest which is a database you can download that is in SQLite format. You can get the manifest from here /Destiny2/Manifest/ which will reduce your calls you need to make to the endpoints (this is a whole other topic though in regards to downloading and reading the manifest). I am not sure if the endpoint /Destiny2/Manifest/{entityType}/{hashIdentifier}/ can be used to get race and gender information? I tried with the DestinyEntitiesCharactersDestinyCharacterComponent and raceHash but got no results. This enpoint is still also in preview mode I believe which means it may not be complete so the manifest is your best bet unless someone knows and endpoiint you can hit now.
If you look up my
raceHashin the manifest database you will see that I am a human and mygenderHashis female.I realize that this a lot of information if you have never used the API before but I hope this can at least get you started in the right direction to querying some data and seeing how the different endpoints and manifest all come together to serve up a lot of powerful information.