-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Vince edited this page Dec 16, 2020
·
15 revisions
A simple API that fetches player statistics from Ubisoft's Rainbow Six website. I tried to make the API as intuitive as possible; let me know if you have any questions/bugs.
All of the objects have methods that must be called sequentially. Each method builds upon the other's response. This means you have to put your code inside of an async
function and use await
.
const r6api = require('./api.js');
var email = 'aValidEmail';
var password = 'aValidPassword';
var platform = 'uplay';
var username = 'aValidUsernameToLookup';
//creates an account
var account = r6api.createAccount(email, password, platform);
//Neon Dawn is technically '1' in Ubi's request structure
var season = '1';
//sequential requests
async function print() {
var session = await r6api.createSession(account).catch(e => { throw new Error(e) });
var player = r6api.createPlayer(username, platform);
await r6api.setPlayerId(player, session).catch(e => { throw new Error(e) });
var neonDawnStats = await r6api.getStatsBySeason(player, session, season).catch(e => { throw new Error(e) });
console.log(neonDawnStats);
}
print();