Blizzard API and ColdFusion

Five years ago Ben Nadel blogged about manipulating Warcraft data from the armory as an XML file.

Today, the armory is nothing but a memory (permanently offline in August 2011) and has been replaced with the Blizzard Community Platform API.  This is actually a great thing… getting and manipulating your data is even easier!

The Blizzard Community Platform API uses RESTful services, so it’s really as easy as playing with some URLs:

<!--- Get Blizzard's RESTful data --->
<cfset serviceURL = "http://us.battle.net/api/wow/guild/Realm/Guild%20Name?fields=members" />
<!--- Returns the Blizzard data --->
<cfhttp method="get" url="#serviceURL#" resolveurl="yes" />
<!--- Because guilds typically consist of members with special characters in their names and setting charset="utf8" in cfhttp doesn't fix the problem --->
<cfset utf8Response = cfhttp.fileContent.toString("UTF8")>
<!--- Converts the Blizzard data into a structure --->
<cfset guildData = DeserializeJSON(utf8Response)>

What this does is return an awesome structure like so:

and the members will be in their own array like so:

You can find the complete API documentation here:
http://blizzard.github.com/api-wow-docs/

And an active support community on the forums:
http://us.battle.net/wow/en/forum/2626217/

The API isn’t perfect… you can tell from the screens above that the data [currently] isn’t pulling a member’s achievement count.  You’re also only limited to 3,000 hits/day, which isn’t a big deal for a small site, but may be few enough for you to want to consider dumping information into a database via cfschedule if you plan on doing anything bigger than a guild website.  Also bear in mind Blizzard’s made it perfectly clear they have no intention on working on the API any further until D3 and MoP are out the door… so we’re stuck with the myriad of bugs and a few missing prominent features.  However the API is pretty darn useful and far better than harvesting data… in fact most notably is that the API pulls in ALL the members as opposed to Blizzard’s site which only shows members over level 10.  Regardless, the API puts a lot of information in your hands for you to manipulate, and ColdFusion makes it a cinch!

Leave a Reply

Your email address will not be published. Required fields are marked *