Initialization

Each StarCraft2-API instance is tied to a specific Battle.net region and requires OAuth credentials for retrieving data. See Blizzard Battle.net docs for information on how to obtain these.

Initialization with OAuth app credentials:

const StarCraft2API = require('starcraft2-api');

const Sc2Api = new StarCraft2API({
  region: 'us', // or 1
  clientId: 'client ID',
  clientSecret: 'client secret',
});

Initalization with OAuth access token:

const StarCraft2API = require('starcraft2-api');

const Sc2Api = new StarCraft2API({
  region: 'us', // or 1
  accessToken: 'access token',
});

Parameters

  • region - one of API regions as specified in Battle.net API docs. BlizzAPI accepts region ID as number or string (e.g. 1, '2') as well as region name as a two-letter country code (e.g. us, kr)
  • clientID - client ID of application registered with Battle.net API
  • clientSecret - client secret of application registered with Battle.net API
  • accessToken (optional) - valid access token issued by Battle.net API endpoint

OAuth authorization

See BlizzAPI docs on OAuth authorization.

Last Updated: 8/3/2019, 2:04:04 PM