View on GitHub

Wowjsapi

Wow JS API wrapper with jQuery and extensive use of jsonp

Download this project as a .zip file Download this project as a tar.gz file

WowApi JS official documentation

WOWAPI is a javascript wrapper around the World of Warcraft public API (http://blizzard.github.io/api-wow-docs/). The Blizzard Community Platform API provides a number of resources for developers and Wow enthusiasts to gather data about their characters, guilds and arena teams. This class leverages the usage of that API to the JS developers by wrapping all API calls in simple JS methods.

WOWAPI

new WOWAPI(region, locale)

Instantiate a WOWAPI object that can be used to call underlying API methods. The data available through the API is limited to the region that it is in. Hence, US APIs accessed through us.battle.net will only contain data within US battlegroups and realms.
Parameters:
Name Type Argument Default Description
region string <optional>
"eu" region Specifies the region that will be used for the API calls. May be ["us", "eu", "kr", "tw", "ch"].
locale string <optional>
First value from selected region locale Specifies the locale to be used with the request. Support for locales is limited to those supported on the World of Warcraft community sites. Possible values are based on the region: { "us": ["en_US", "es_MX", "pt_BR"], "eu": ["en_GB", "es_ES", "fr_FR", "ru_RU", "de_DE", "pt_PT", "it_IT"], "kr": ["ko_KR"], "tw": ["zh_TW"], "ch": ["zh_CN"] }
Author:
  • eduardm (https://github.com/eduardm/wowjsapi)
License:
  • Creative Commons Zero (CC0)
Source:
Example
 var wowApiInstance = new WOWAPI("eu", "en_GB");

Requires

  • module:JQuery

Methods

getAchievement(achievementId, callbackFunction)

Returns the achievement data for given achievement. Wraps this API function
Parameters:
Name Type Description
achievementId Integer The achievement number
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getAchievement(2144, function(data) {console.log(data)});

getAuctions(realm, callbackFunction)

Returns the current auction house data for given realm. Wraps this API function
Parameters:
Name Type Description
realm String The realm name
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getAuctions('medivh', function(data) {console.log(data)});

getBattlePetAbility(abilityId, callbackFunction)

Returns details about given ability id. Wraps this API function
Parameters:
Name Type Description
abilityId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getBattlePetAbility(640, function(data) {console.log(data)});

getBattlePetSpecies(speciesId, callbackFunction)

Returns details about given species id. Wraps this API function
Parameters:
Name Type Description
speciesId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getBattlePetAbility(640, function(data) {console.log(data)});

getBattlePetStats(speciesDetails, callbackFunction)

Returns details about given battle pet parameters. Wraps this API function
Parameters:
Name Type Description
speciesDetails battlePetObject
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 
              wowApiInstance.getBattlePetStats({
                  speciesId: 640,
                  level: 25,
                  breedId: 3,
                  qualityId: 1
              }, function (data) {
                 console.log(data);
              });

getChallengeLeaderboard(realm, callbackFunction)

Returns the current challenge mode leaderboard for given realm or for region. Wraps this API function
Parameters:
Name Type Description
realm String | null The realm name. If it is null, it will return region leaderboard
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getChallengeLeaderboard("steamwheedle-cartel", function (data) {console.log(data);});
wowApiInstance.getChallengeLeaderboard(null, function (data) {console.log(data);});

getCharacterProfile(characterOptions, callbackFunction)

Returns character profile based on a characterOptions object. Wraps this API function
Parameters:
Name Type Description
characterOptions characterOptions Contains the options describing what to retrieve
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getCharacterProfile({realm: "steamwheedle-cartel",characterName: "HarapAlb"}, function (data)
             {console.log(data);});
wowApiInstance.getCharacterProfile({realm: "steamwheedle-cartel",characterName: "HarapAlb",fields: "items"}, function (data) { console.log(data); });
wowApiInstance.getCharacterProfile({realm: "steamwheedle-cartel", characterName: "HarapAlb", fields: "items, pets, stats, titles"}, function (data) {console.log(data);});

getGuildProfile(guildOptions, callbackFunction)

Returns guild profile based on a guildOptions object. Wraps this API function
Parameters:
Name Type Description
guildOptions guildOptions Contains the options describing what to retrieve
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 
              wowApiInstance.getGuildProfile({
                  realm: "steamwheedle-cartel",
                  guildName: "House of Elements"
              }, function (data) {
                 console.log(data);
              });
wowApiInstance.getGuildProfile({ realm: "steamwheedle-cartel", guildName: "House of Elements", fields: "members, achievements, news, challenge" }, function (data) { console.log(data); });

getIemSet(setId, callbackFunction)

Returns details about given item set id. Wraps this API function
Parameters:
Name Type Description
setId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getItem(1060, function(data) {console.log(data)});

getItem(itemId, callbackFunction)

Returns details about given item id. Wraps this API function
Parameters:
Name Type Description
itemId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getItem(18803, function(data) {console.log(data)});

getPVPLeaderboard(bracket, callbackFunction)

Returns the PVP leaderboard for given bracket. Wraps this API function
Parameters:
Name Type Description
bracket String The bracket for the leaderborad. One of: "2v2" | "3v3" | "5v5" | "rbg"
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getPVPLeaderboard("3v3", function (data) { console.log(data); });

getRealmStatus(realms, callbackFunction)

Returns the realm(s) status. Wraps this API function
Parameters:
Name Type Description
realms String | null The list of realms to get status, or null for all realms from region
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 
               wowApiInstance.getRealmStatus(null, function (data) {
                  console.log(data);
               });
wow.getRealmStatus("steamwheedle-cartel,medivh", function (data) { console.log(data); });

getRecipe(recipeId, callbackFunction)

Returns details about given recipe id. Wraps this API function
Parameters:
Name Type Description
recipeId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getRecipe(33994, function(data) {console.log(data)});

getSpell(spellId, callbackFunction)

Returns details about spell recipe id. Wraps this API function
Parameters:
Name Type Description
spellId Integer
callbackFunction responseCallback A callback function that will be triggered when we have the data
Source:
Example
 wowApiInstance.getSpell(8056, function(data) {console.log(data)});

Type Definitions

battlePetObject

Type:
  • Object
Properties:
Name Type Argument Default Description
speciesId Integer SpeciesId for what we want the stats
level Integer <optional>
1 Level of the pet to display stats
breedId Integer <optional>
3 Specify the breed
qualityId Integer <optional>
1 Specify quality
Source:

characterOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
realm String Realm name
characterName String Character name
fields String <optional>
"" String with one or more fields from the profile separated by comma. If it is missing, only the summary will be returned. Possible values:
     achievements    A map of achievement data including completion timestamps and criteria information.
     appearance    A map of values that describes the face, features and helm/cloak display preferences and attributes.
     feed    The activity feed of the character.
     guild    A summary of the guild that the character belongs to. If the character does not belong to a guild and this field is requested, this field will not be exposed.
     hunterPets    A list of all of the combat pets obtained by the character.
     items    A list of items equiped by the character. Use of this field will also include the average item level and average item level equipped for the character.
     mounts    A list of all of the mounts obtained by the character.
     pets    A list of the battle pets obtained by the character.
     petSlots    Data about the current battle pet slots on this characters account.
     professions    A list of the character's professions. It is important to note that when this information is retrieved, it will also include the known recipes of each of the listed professions.
     progression    A list of raids and bosses indicating raid progression and completedness.
     pvp    A map of pvp information including arena team membership and rated battlegrounds information.
     quests    A list of quests completed by the character.
     reputation    A list of the factions that the character has an associated reputation with.
     stats    A map of character attributes and stats.
     talents    A list of talent structures.
     titles    A list of the titles obtained by the character including the currently selected title.
          
Source:

guildOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
realm String Realm name
guildName String Guild name
fields String <optional>
"" String with one or more fields from the profile separated by comma. If it is missing, only the summary will be returned. Possible values:
     members    A list of characters that are a member of the guild
     achievements    A set of data structures that describe the achievements earned by the guild.
     news    A set of data structures that describe the news feed of the guild.
     challenge    The top 3 challenge mode guild run times for each challenge mode map.
          
Source:

responseCallback(data)

Parameters:
Name Type Description
data JSON JSON containing requested data
Source: