R6StatAPI Setup
This is an simple overview, on how to setup R6StatAPI in your project.
index.js
const { R6StatAPI } = require("r6statapi");
const api = new R6StatAPI();
// replace with your own information
const email = "test@gmail.com"
const password = "Password123"
const usermame = "CaleyW1"
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'
}
We recommend using TypeScript for better type safety.