Skip to content
Sample REST API based on Express.js demonstrating BlizzAPI features
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.env.sample
.gitignore
.travis.yml
LICENSE
README.md
app.json
appveyor.yml
index.js
jest.config.js
nodemon.json
package-lock.json
package.json

README.md

BlizzAPI logo

blizzapi-example

Travis CI Build Status AppVeyor Build status Maintainability Test Coverage Greenkeeper badge

Sample REST API based on Express.js demonstrating BlizzAPI features.

Note that this project is for illustrative purposes only. It is not designed to run as a production server.

Deploy to Heroku Deploy to now

Install

git clone https://github.com/lukemnet/blizzapi-example.git
cd blizzapi-example
npm install

Setup

Register a client app with Blizzard Battle.net Developer Portal. Note down client id and client secret.

Copy and rename the file .env.sample to .env. Edit it accordingly:

PORT='8080'
API_BATTLENET_KEY='your client app id'
API_BATTLENET_SECRET='your client app secret'

Run

With Node:

npm start

With Nodemon:

nodemon start.js

Available endpoints

API endpoints

GET /api/query/:region?endpoint=:endpoint

Fetches data from a Battle.net API endpoint using a specified regional server using BlizzAPI.query method.

Example: http://localhost:8085/api/query/1?endpoint=/sc2/profile/1/2/242838

GET /api/validateAccessToken/:region/:accessToken

Checks if access token is valid using BlizzAPI.validateAccessToken method.

Example: http://localhost:8085/api/validateAccessToken/eu/sampleAccessToken

GET /api/getAccessToken/:region

Obtains and returns OAuth access token using BlizzAPI.getAccessToken method.

Example: http://localhost:8085/api/getAccessToken/eu

Utility endpoints

Utility endpoints match the following pattern:

GET /utils/BlizzAPI_funtion_name_here/:parameter1/:parameter2ifNeeded

Examples:

http://localhost:8085/utils/getAllRegions
http://localhost:8085/utils/validateRegionName/eu
http://localhost:8085/utils/isLocaleValidForRegionId/en_US/1

For a complete list of method names see BlizzAPI utility methods.

License

Licensed under MIT License. See LICENSE for more information.

Legal

Battle.net and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.

You can’t perform that action at this time.