bunr6statapi
v2.0.1
Published
Wrapper for Rainbow Six Siege API
Downloads
18
Readme
Table of Contents
Installation
npm i r6statapi
Getting Started
To get started you will need a Ubisoft login, it is best to create a new account and not the account you normally use. Create a new account here
The example below has the email and password variables hardcoded but it would be better to use dotenv to manage environment variables.
import r6statapi from 'r6statapi';
const api = new r6statapi();
// or CommonJS
const { R6StatAPI } = require("r6statapi");
const api = new R6StatAPI();
// replace with your own information
const email = "[email protected]"
const password = "Password123"
const usermame = "User1"
const platform = "uplay"
// login and get token
const token = await api.login(email, password)
console.log(token)
// fetch user by username
const user = await api.getUserByUsername(userName, platform);
console.log(user);
// example response
{
profileId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
userId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
platformType: 'uplay',
idOnPlatform: 'AFC2AFEC-B9ED-4988-BFFA-58E78EEDFA93',
nameOnPlatform: 'CaleyW1'
}
Functions
Table of Contents
- Login
- GetUserByUsername
- GetUserByUserId
- GetUserProgression
- GetServerStatus
- GetUserRank
- GetUserStats
- GetOperators
Login
Signs into the Ubisoft a returns a token.
| Field | Type | Required | | -------- | ------ | -------- | | email | string | yes | | password | string | yes |
await api.Login(email, password)
Example response
ewogICJ2ZXIiOiAiMSIsCiAgImFpZCI6ICJlM2Q1ZWE5ZS01MGJkLTQzYjctODhiZi0zOTc5NGY0ZTNkNDAiLAogICJlbnYiOiAiUHJvZCIsCiAgInNpZCI6ICI2YzVlY2E4MS1jYWI3LTQ0NjItOWUzOC04YjZkODA5OWQ1ZjEiLAogICJ0eXAiOiAiSldFIiwKICAiZW5jIjogIkExMjhDQkMiLAogICJpdiI6ICJPellRVVNkSkswNzJURTFJTXVpdFhnIiwKICAiaW50IjogIkhTMjU2IiwKICAia2lkIjogImFkNWNjMzFhLWI2ZmQtNGYyZS04N2JmLTNjZjRkOTc1OTY2NSIKfQ.-F6ZqzG9mOze0HRYJh3Ub23dQUR9BLR-VM7hMgbisN3tQZ1XLgZFyVH2sFmm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mC2Ro5dOKIjQwZA6D-uEkAhBFsibp3tOIzWAjQChCR89hJy9IS2O7PMWs31rxINAKdx43jb6llgTRsUGDXYLL1eKYecUd7orY8frlAYXU1xLmDBzBpn6wzbMRNNoFfiI1KG9rUKR8EDPUv26GcfsBzkuSHeFXSi_Xhg.oMj2gpJl_2eOj-pFuYvFyWr_t1JR48zgb2st82KTKWk
Get user by username
Gets a user by username
| Field | Type | Required | options | | -------- | ------ | -------- | --------------- | | username | string | yes | | | platform | string | yes | uplay, xbl, psn |
await api.getUserByUsername(userName, platform);
Example response
{
profileId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
userId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
platformType: 'uplay',
idOnPlatform: 'AFC2AFEC-B9ED-4988-BFFA-58E78EEDFA93',
nameOnPlatform: 'CaleyW1',
avatars: {
'146': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_146_146.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'256': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_256_256.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'500': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_tall.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a'
}
}
Get user by userId
Gets a user by userId
| Field | Type | Required | options | | -------- | ------ | -------- | --------------- | | userId | string | yes | | | platform | string | yes | uplay, xbl, psn |
await api.getUserById(user.userId, platform);
Example response
[
{
profileId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
userId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
platformType: 'uplay',
idOnPlatform: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
nameOnPlatform: 'CaleyW1',
avatars: {
'146': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_146_146.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'256': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_256_256.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'500': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_tall.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a'
}
},
{
profileId: 'f02cbe10-2411-43d9-b449-5366888201a2',
userId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
platformType: 'steam',
idOnPlatform: '76561198172917981',
nameOnPlatform: '76561198172917983',
avatars: {
'146': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_146_146.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'256': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_256_256.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'500': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_tall.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a'
}
},
{
profileId: '91193155-2b57-48f1-b69b-556f5e4ccfea',
userId: 'afc2afec-b9ed-4988-bffa-58e78eedfa93',
platformType: 'twitch',
idOnPlatform: '469658264',
nameOnPlatform: 'calbob',
avatars: {
'146': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_146_146.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'256': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_256_256.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a',
'500': 'https://avatars.ubisoft.com/afc2afec-b9ed-4988-bffa-58e78eedfa93/default_tall.png?appId=3587dcbb-7f81-457c-9781-0e3f29f6f56a'
}
}
]
Get user progression
gets the progression for a user
| Field | Type | Required | options | | -------- | ------ | -------- | --------------- | | userId | string | yes | | | platform | string | yes | uplay, xbl, psn |
await api.getUserProgression(user.userId, platform);
Example response
{
level: 326,
xp: 129949
}
Get server status
Returns the status of a platform
platforms: pc, xbox, ps4
await api.getServerStatus(platfrom)
Example response
{
MDM: '4075',
SpaceID: '98a601e5-ca91-4440-b1c5-753f601a2c90',
Category: 'Instance',
Name: 'Rainbow Six Siege - XBOXONE - LIVE',
platform: 'XBOXONE',
status: 'Online',
maintenance: null,
impactedFeatures: []
}
Get user rank
Returns statistics for different gamemodes
| Field | Type | Required | options | | -------- | ------ | -------- | --------------- | | userId | id | yes | | | platform | string | yes | uplay, xbl, psn |
await api.getUserRank(player.userId, platfrom);
Example response
{
casual: {
profile_board_id: 'casual',
id: 'casual',
max_rank: 0,
max_rank_points: 0,
platform_family: 'console',
rank: 0,
rank_points: 0,
rank_name: undefined,
season_id: 34,
top_rank_position: 0,
deaths: 14,
kills: 15,
abandons: 3,
losses: 4,
wins: 2
},
event: {
profile_board_id: 'event',
id: 'event',
max_rank: 0,
max_rank_points: 0,
platform_family: 'console',
rank: 0,
rank_points: 0,
rank_name: undefined,
season_id: 34,
top_rank_position: 0,
deaths: 0,
kills: 0,
abandons: 0,
losses: 0,
wins: 0
},
warmup: {
profile_board_id: 'warmup',
id: 'warmup',
max_rank: 0,
max_rank_points: 0,
platform_family: 'console',
rank: 0,
rank_points: 0,
rank_name: undefined,
season_id: 34,
top_rank_position: 0,
deaths: 10,
kills: 21,
abandons: 1,
losses: 0,
wins: 1
},
standard: {
profile_board_id: 'standard',
id: 'standard',
max_rank: 0,
max_rank_points: 0,
platform_family: 'console',
rank: 0,
rank_points: 0,
rank_name: undefined,
season_id: 34,
top_rank_position: 0,
deaths: 0,
kills: 0,
abandons: 0,
losses: 0,
wins: 0
},
ranked: {
profile_board_id: 'ranked',
id: 'ranked',
max_rank: 36,
max_rank_points: 6788,
platform_family: 'console',
rank: 36,
rank_points: 6788,
rank_name: undefined,
season_id: 34,
top_rank_position: 3,
deaths: 2473,
kills: 4759,
abandons: 7,
losses: 41,
wins: 964
}
}
Get Operator
Gets seasonal operator statistics
| Field | Type | Required | options | Notes | | ----------- | ------ | -------- | -------------------------------- | ------------------------------------------------------ | | userId | Id | Yes | | | platform | string | Yes | uplay, xbl, psn | | view | string | Yes | seasonal | | aggregation | string | Yes | operator | | gameMode | string | Yes | all, casual, ranked, unranked | | team role | string | Yes | Attacker, Defender | "Defender" and "Attacker" need to start with capitals. | | season | string | Yes | format Y(No.)S(No.) Example Y6S3 |
const operator = await api.getUserOperators(
userId,
platform,
view,
aggregation,
gameMode,
teamRole,
season
);
// sample
const operators = await api.getUserOperators(
user.userId,
"uplay",
"current",
"operators",
"all,ranked,casual,unranked",
"Defender,Attacker",
"Y9S2"
);
Example Response
{
ranked: {
attackers: [
{
type: 'Generalized',
statsType: 'operators',
statsDetail: 'Montagne',
matchesPlayed: 84,
roundsPlayed: 114,
minutesPlayed: 343,
matchesWon: 81,
matchesLost: 3,
roundsWon: 92,
roundsLost: 22,
kills: 81,
assists: 16,
deaths: 44,
headshots: 4,
meleeKills: 51,
teamKills: 0,
openingKills: 5,
trades: 5,
openingKillTrades: 2,
openingDeathTrades: 0,
revives: 1,
distanceTravelled: 14418,
winLossRatio: 27,
killDeathRatio: 1.8409,
headshotAccuracy: 0.0494,
killsPerRound: 0.7105,
roundsWithAKill: 0.7105,
roundsWithMultiKill: 0.1667,
roundsWithOpeningKill: 0.0439,
roundsWithOpeningDeath: 0.0614,
roundsWithKOST: 0.7544,
roundsSurvived: 0.614,
roundsWithAnAce: 0,
roundsWithClutch: 0.0175,
timeAlivePerMatch: 109.6905,
timeDeadPerMatch: 20.1667,
distancePerRound: 126.4737
}
],
defenders: []
},
unranked: { attackers: [], defenders: [] },
all: { attackers: [], defenders: [] },
casual: { attackers: [], defenders: [] }
}
Support
For any questions, bugs or feedback, please use our Discord or create an issue on Github