teaching machines

Adam King: Web APIs

November 1, 2012 by . Filed under cs491 mobile, fall 2012, postmortems.

For my Web API assignment, I decided to use the World of Warcraft Community API to develop an app that lets you view relevant character information.  The features I implemented for now mostly focus on looking at raid progression and item level, allowing the user to check a character’s progression across all of the raids and their last equipped items on login.  The links activity is also in the list of options, as well as an “Armory Webpage” option which will send the user to Blizzard’s World of Warcraft Armory page for that character.  If the user enters an invalid realm or character, a bunch of errors would obviously be thrown.  Instead of doing this or sending the user back to the main activity, a message is placed in the header that informs users the character or realm were invalid.  This allows users to still access the Links activity even if the character isn’t valid.  However, until it is seen that there is a valid character input and it has loaded the header information, the options related to the character are locked.  This one boolean value knocked out a very large number of errors or bugs.

Pages relevant to the character have a header at the top of the activity, showing the character’s name, server, level, and class, along with the stored avatar of that character (XML includes!).  The progression option shows each boss under their respective raid instances (green for raid instance, white for boss) and the character’s kills of each boss in Normal and Heroic modes.  The items option shows the items and their rarity (color-coded) in each of the equip slots for the character.  Since the API is rather fragmented, it would’ve been a large ordeal to retrieve useful information about the items (“large” as in creating a separate connection for every single item).  Instead, the list has a listener which will send the user to the WoW Armory page to view the item, so useful item information is at least linked up to the item instead of only being able to see the name and slot.

Besides XML includes and learning how to deal with JSON when formatting in inconvenient ways across many different connections, I messed with Activity flags more.  In not allowing an activity to be kept in the history stack, it is immediately killed when navigating away so that it will always produce only the freshest, organic (live) data.   It also effectively seems to push the user back to the character options menu upon return, which worked out nicely.

Being subject to the API’s results, there was one strange case of a duplicate boss listed in an instance, and the average item levels seem like they may not necessarily match up in live time, though most of the other information seems to.  I also only included an English release because the app only works for US servers at the moment; adding multilingual support would’ve been a fairly arduous task to find how Blizzard translates all of the information, and supporting non-US servers would add another input and some research into how the API functions and what it returns for JSON.  However, with the framework nailed down and the way I set the options list up, I made sure it would be easy to go back in and add more features later.  The actual API has almost anything you could ever want to know about a character or realm, and I’d like to think I’ll return to this app someday to add more features, possibly support non-US servers and other languages, and overall polish it up a bit..