More WoW API information

· Submitted · Read in about 4 min · (667 Words)
tags: · wow · tech ·

I’ve recently been working more on the WoW API, specifically around hunter pet mapping. I have found several new discoveries from the last time I worked on the API.

Racial mapping

When retrieving character race data from the API, you simply receive a number. Here’s a table that maps that number to the respective race:

Alliance:

  • 1 - human
  • 3 - dwarf
  • 4 - nightelf
  • 7 - gnome
  • 11 - draenei
  • 22 - worgen
  • 25 - panda-a

Horde:

  • 2 - orc
  • 5 - undead
  • 6 - tauren
  • 8 - troll
  • 9 - goblin
  • 10 - bloodelf
  • 26 - panda-h

Neutral (temporary):

  • 24 - panda-n

Parsing an entire realm’s characters

I am using the RealmPop method of parsing realm character data, namely:

How - To get the list of characters for a realm, first we record all the characters who posted to the auction house. Then we fetch and record their guild rosters. This should cover the majority of characters on a realm. To avoid getting listed, a character must never post to the auction house, and never belong to a guild where a guild member posts to the auction house.

So, how would you go about this? Realm auction data is packaged up into unique files every so often, and the URL of that package changes. There’s an API endpoint that will give you the latest URL of that data package.

http://us.battle.net/api/wow/auction/data/**$realm**

When you that URL, you’ll get back the file url for the auction data package. Then, you grab that data package. Here’s a recent Mal’Ganis package, for example:

http://us.battle.net/auction-data/e93144540f4aa366aefe80b13d2ebbb9/auctions.json

Once you have the auction data, you crawl through it and pull out the auction owners. The file is separated into Horde/Alliance/Neutral auction houses. I usually compile a list of auction owners from all 3 sets. I don’t record the faction data here, since it’s also contained (implicitly) in the race data I gather later. So now you just have a big list of all of the people that have current auctions posted. Then, you grab their guild information.

http://us.battle.net/api/wow/character/**$realm**/**$owner**?fields=guild

Now you turned your big list of auction owners into a big list of guilds! Finally, you then parse each guild’s roster:

http://us.battle.net/api/wow/guild/**$realm**/**$guild**?fields=members

RealmPop is probably done at this point, since they only really care about the basic member information. I wanted to dig deeper, so I parse out the list of members, select those that are hunters (class = 3), and then I grab their individual Armory information:

http://us.battle.net/api/wow/character/$realm/$member?fields=hunterPets,guild

Pet family mapping

Similar to the racial and class mapping, each pet family type is also mapped to a number. Here’s a table:

  • 1 - Wolf
  • 2 - Cat
  • 3 - Spider
  • 4 - Bear
  • 5 - Boar
  • 6 - Crocolisk
  • 7 - Carrion Bird
  • 8 - Crab
  • 9 - Gorilla
  • 11 - Raptor
  • 12 - Tallstrider
  • 20 - Scorpid
  • 21 - Turtle
  • 24 - Bat
  • 25 - Hyena
  • 26 - Bird of Prey
  • 27 - Wind Serpent
  • 30 - Dragonhawk
  • 31 - Ravager
  • 32 - Warp Stalker
  • 33 - Sporebat
  • 34 - Nether Ray
  • 35 - Serpent
  • 37 - Moth
  • 38 - Chimaera
  • 39 - Devilsaur
  • 41 - Silithid
  • 42 - Worm
  • 43 - Rhino
  • 44 - Wasp
  • 45 - Core Hound
  • 46 - Spirit Beast
  • 50 - Fox
  • 51 - Monkey
  • 52 - Dog
  • 53 - Beetle
  • 55 - Shale Spider
  • 125 - Crane
  • 126 - Water Strider
  • 127 - Porcupine
  • 128 - Quilen
  • 129 - Goat
  • 130 - Basilisk
  • 138 - Direhorn

  • 59 - Silithid – (this specifically is the “brain bug” version)

  • 66 - Wasp – (the new silithid wasp)

  • 68 - Hydra – (very rare, only one known pet, now unobtainable, was actually retconned to ‘hydra’ in Cataclysm, was previously a ‘crocolisk’ type)

I’ll note that there are some additional mappings for other languages. For example, in the Spanish client, ‘Cat’ is translated to ‘Gato’, so a tamed cat-type will actually be named ‘Gato’. Now, some people also do funny things like name their wolves and scorpions ‘Gato’, but that’s unrelated.