Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
battlenet-api
Advanced tools
A Node JS wrapper for the Battle.net API
Add battlenet-api
to your application's package.json
file and run:
npm install
Alternatively:
npm install battlenet-api --save
Simply require()
the Battle.net API within your application:
var bnet = require('battlenet-api');
And then access the API methods to request data:
bnet.wow.character.profile(obj, callback);
Your private Battle.net API key is input with the BATTLENET_API_KEY
environment variable. This must be present in order to get a proper response. There are a variety of ways to set this variable but the easiest is to run your node server with the variable from the command line.
$ sudo BATTLENET_API_KEY=[your_api_key] node server.js
Each API method receives a parameters object for the request, and a callback function to execute once the request has completed. The available request parameters are explained for each method below.
callback
takes three arguments: error
, response
, and body
.
The World of Warcraft API methods are available through the wow
object of the Battle.net API.
var wow = bnet.wow;
ALL API methods take region
as one of its parameters. The possible values are us
, eu
, kr
, tw
. The China API is unavailable at this time.
Parameters
region
[us
, eu
, kr
, tw
]
id
the unique achievement ID.
Usage
bnet.wow.achievement({region: 'us', id: 2144}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
realm
the slugified realm name.
Usage
bnet.wow.auction({region: 'us', realm: 'proudmoore'}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
id
the unique ID of the battle pet ability.
Usage
bnet.wow.battlepet.ability({region: 'us', id: 640}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
id
the unique ID of the battle pet species.
Usage
bnet.wow.battlepet.species({region: 'us', id: 258}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
id
the unique ID of the battle pet species.
fields
an object containing the battle pet level
, breedId
, and qualityId
Usage
bnet.wow.battlepet.stats({region: 'us', id: 258, fields: { level: 25, breedId: 5, qualityId: 4 }}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
realm
the slugified realm name.
Usage
bnet.wow.challenge.realmLeaderboard({region: 'us', realm: 'proudmoore'}, callback);
Parameters
region
[us
, eu
, kr
, tw
].
Usage
bnet.wow.challenge.regionLeaderboard({region: 'us'}, callback);
All character requests require the following parameters:
region
[us
, eu
, kr
, tw
].
realm
the slugified realm of the character.
name
the name of the character.
Returns basic profile data about the character.
Usage
bnet.wow.character.profile({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the achievement data of the character.
Usage
bnet.wow.character.achievements({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the appearance data of the character.
Usage
bnet.wow.character.appearance({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the guild data of the character.
Usage
bnet.wow.character.guild({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the hunter pet data of the character (where applicable).
Usage
bnet.wow.character.hunterPets({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the item data of the character.
Usage
bnet.wow.character.items({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the mount data of the character.
Usage
bnet.wow.character.mounts({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the pet data of the character.
Usage
bnet.wow.character.pets({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the pet slots data of the character.
Usage
bnet.wow.character.petSlots({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the progression data of the character.
Usage
bnet.wow.character.progression({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the PVP data of the character.
Usage
bnet.wow.character.pvp({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the quest data of the character.
Usage
bnet.wow.character.quests({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the reputation data of the character.
Usage
bnet.wow.character.reputation({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the statistics data of the character.
Usage
bnet.wow.character.stats({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the talent data of the character.
Usage
bnet.wow.character.talents({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the title data of the character.
Usage
bnet.wow.character.titles({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns an audit of the character's equipment.
Usage
bnet.wow.character.audit({region: 'us', realm: 'proudmoore', name: 'charni'}, callback);
Returns the specified character fields aggregated in a single request.
Parameters
fields
an array of one or more character fields.
Usage
bnet.wow.character.aggregate({region: 'us', realm: 'proudmoore', name: 'charni', fields: ['pets', 'petSlots']}, callback);
Returns the item data of the specified item id.
Parameters
region
[us
, eu
, kr
, tw
].
id
the unique item id.
Usage
bnet.wow.item.item({region: 'us', id: 18803}, callback);
Returns the item set data of the specified set id.
Parameters
region
[us
, eu
, kr
, tw
].
id
the unique item set id.
Usage
bnet.wow.item.item({region: 'us', id: 1060}, callback);
All guild requests require the following parameters:
region
[us
, eu
, kr
, tw
].
realm
the slugified realm of the guild.
name
the name of the guild.
Returns basic profile data of the guild.
Usage
bnet.wow.guild.profile({region: 'us', realm: 'proudmoore', name: 'black wolf mercenaries'}, callback);
Returns the members data of the guild.
Usage
bnet.wow.guild.members({region: 'us', realm: 'proudmoore', name: 'black wolf mercenaries'}, callback);
Returns the achievement data of the guild.
Usage
bnet.wow.guild.achievements({region: 'us', realm: 'proudmoore', name: 'black wolf mercenaries'}, callback);
Returns the news data of the guild.
Usage
bnet.wow.guild.news({region: 'us', realm: 'proudmoore', name: 'black wolf mercenaries'}, callback);
Returns the challenge data of the guild.
Usage
bnet.wow.guild.challenge({region: 'us', realm: 'proudmoore', name: 'black wolf mercenaries'}, callback);
FAQs
A Node.JS library for the Battle.net Community Platform API
The npm package battlenet-api receives a total of 54 weekly downloads. As such, battlenet-api popularity was classified as not popular.
We found that battlenet-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.