JavaScript is required to use Bungie.net

#programming

впервые опубликовано в:BungieNetPlatform
Изменено (DystinctVertex): 4/13/2015 10:15:14 PM
2

Help with GetDestinyExplorerItems

How would one get a list of all armor and weapons in destiny in a JSON response which would include stats, type, bucket, rarity and icons? I am having trouble figuring this out with the GetDestinyExplorerItems call.
English
#programming #api

Публикуется на языке:

 

Играйте достойно. Потратьте минутку на ознакомление с нашими правилами, прежде чем отправлять вашу запись. Отмена Изменить Создать боевую группу Опубликовать

  • Take a look at the Explorer/Items endpoint help docs, https://www.bungie.net/platform/destiny/help/HelpDetail/GET?uri=Explorer%2fItems%2f While you can't get everything in one call, you can use the page param like Scapegoat uses. Also, the buckets param is very helpful and allows you to pass in all the buckets you want, so, http://www.bungie.net/Platform/Destiny/Explorer/Items/?buckets=PrimaryWeapon,SpecialWeapon,HeavyWeapon&count=500&definitions=true would get you all the weapons, in groups/pages of 500 items each. so you'd want to add &page=1/&page=2 to each subsequent call until you have all the items. As far as the stats, perks, etc... make sure you add &definitions=true to get the definitions with your calls so you'll know that Response->data->items->YourItem->statHash: "12345" links up with Response->definitions->stats->statHash "12345" and now you know that gun has a stat value for Stability or Damage or whatever

    Публикуется на языке:

     

    Играйте достойно. Потратьте минутку на ознакомление с нашими правилами, прежде чем отправлять вашу запись. Отмена Изменить Создать боевую группу Опубликовать

    6 отв.
    • Изменено (JerkLine): 4/14/2015 1:36:35 AM
      You can construct a query in the url, like: [url]https://www.bungie.net/Platform/Destiny/Explorer/Items/?count=100&page=0[/url] and then increment the page. A simple Python script with the python-requests library would look something like: [quote] import requests weapon_list = [] params = { 'buckets': ['PrimaryWeapon', 'SpecialWeapon', 'HeavyWeapon'], 'count': 100, 'page': 0 } json_response = requests.get('https://www.bungie.net/Platform/Destiny/Explorer/Items/', params=params).json() data = json_response['Response']['data'] weapon_list += data['itemHashes'] while data['hasMore']: params['page'] += 1 json_response = requests.get('https://www.bungie.net/Platform/Destiny/Explorer/Items/', params=params).json() data = json_response['Response']['data'] weapon_list += data['itemHashes'] [/quote] Forgive the awful formatting. Also, I don't know what the rate limits are and I didn't account for it in that script. Also I assume the item hashes are what you want.

      Публикуется на языке:

       

      Играйте достойно. Потратьте минутку на ознакомление с нашими правилами, прежде чем отправлять вашу запись. Отмена Изменить Создать боевую группу Опубликовать

      3 отв.
      У вас нет прав для просмотра этих материалов.
      ;
      preload icon
      preload icon
      preload icon