API doc for the RLRC ranks

What is RLRC?
RLRC is a small API used for Rocket League ranking stats. The API contains functionalities to get any player rankings as well to generate equal teams for inhouse small tournaments.

Also there is an UI to use this tool for any non tech savy persons who would also like to host small tournaments or want to compare yourself and your friends stats with other players.

Below you'll find everything needed to get you started, the registration form, example app and as well the UI library, if you have your own website where you want to host it.

Support discord

RLRC@discord

Official RLRC bot

RLRC@top.gg

Distribution

Distribution by RLRC

Donation

All donators will be eligible for RLRC bot premium features.

The conext of this project is free to use, but if you have any extra bucks laying around feel free to throw in any amount to help with the hosting costs.

Also it will be a huge motivation booster to keep on working with this project.

Patreon

Click HERE to support this project through patreon.

Crypto

DM in discord to talk about crypto.

Paypal


App registration and authentication (optional)

Authentication is only required if you want to have your own app and handle the users list
Authentication is not required to get stats or build teams
If you are authenticated and request any stats - the user will be added under your app

Create your own app

Use this form here if you are here just for the UI.

POST

https://mnz.ee/rlrc/api/auth/register

Register your own app that you can manage, check, analyze etc. with the UI library or via API.
Each registred app is instanly accessible through rlrc/app as well. eg: https://mnz.ee/rlrc/app/your_app_name

Example body

{
    "app": "your_app_name",
    "secret": "the_password_for_the_app"
}

After registration the app is instantly accessible through
https://mnz.ee/rlrc/app/your_app_name

Heres an example of the app with the ID of RLPRO

Use the APP key

Put the app key into the request
Headers: {app: 'your_app_id'}

POST

https://mnz.ee/rlrc/api/auth/login

Get Bearer token to make requests under your own app. Single token is active up to 24h

Example body

{
    "secret": "your_secret"
}

Example response

{
    "result": {
        "authorization": "generated_session_token"
    }
}

Use the Bearer token

Put the authorization header key with each request
Headers: {Authorization: Bearer 'generated_session_token'}

GET

https://mnz.ee/rlrc/api/auth/logout

Expires the session token

Example response

{
    "result": true
}
GET

https://mnz.ee/rlrc/api/auth/status

Get current token status

Example response

{
    "result": true
}

Description of the API

Supported platforms

["steam","epic","xbox","psn","switch"]

Playlist keys used in the Data Models

["unranked","duel","doubles","standard","hoops","rumble","dropshot","snowday","tournament"]

Description of the <Player Model>

{
    "steam_id": "steam id" or null,
    "profile_id": "profile id" or null,
    "epic_id": "epic id" or null,
    "xbox_id": "xbox id" or null,
    "psn_id": "psn id" or null,
    "switch_id": "switch id" or null,
    "primary_id": "depending on the platform one of the _id"
    "platform": "one of the platforms",
    "name": "players current name in platform",
    "custom_name": null,
    "ranks": <Ranks Model>,
    "peak": <Peaks Model>
}

Description of the <Ranks Model>

{
    "unranked": 1234
    "duel": 1234
    "doubles": 1234
    "standard": 1234
    "hoops": 1234
    "rumble": 1234
    "dropshot": 1234
    "snowday": 1234
    "tournament": 1234
    "date": "24.05.2020" // included only in the details endpoint
}

Description of the <Peaks Model>

{
    "seven": 1234,
    "thirty": 1234
}

Description of the <Meta Model>

{
    "unranked": <Meta Item Model>
    "duel": <Meta Item Model>
    "doubles": <Meta Item Model>
    "standard": <Meta Item Model>
    "hoops": <Meta Item Model>
    "rumble": <Meta Item Model>
    "dropshot": <Meta Item Model>
    "snowday": <Meta Item Model>
    "tournament": <Meta Item Model>
}

Description of the <Meta Item Model>

{
    "tier": <Tier>,
    "division": <Division>
}

Description of the <Distribution Model>

{
    "min": 1234,
    "max": 1234
}

List of <Tier>

[
    "Unranked",
    "Bronze I",
    "Bronze II",
    "Bronze III",
    "Silver I",
    "Silver II",
    "Silver III",
    "Gold I",
    "Gold II",
    "Gold III",
    "Platinum I",
    "Platinum II",
    "Platinum III",
    "Diamond I",
    "Diamond II",
    "Diamond III",
    "Champion I",
    "Champion II",
    "Champion III",
    "Grand Champion I",
    "Grand Champion II",
    "Grand Champion III",
    "Supersonic Legend"
]

List of <Division>

[
    "Division I",
    "Division II",
    "Division III",
    "Division IV"
]
GET

https://mnz.ee/rlrc/api/user/stats/:id?platform=:platform

Get current stats for player.

Example response

{
    "result": <Player Model>
}
GET

https://mnz.ee/rlrc/api/user/details/:id?platform=:platform

Get users historycal stats, response will be array of <Ranks Model> with the date key for each day
Each day uses value of that days highest mmr.

Example response

{
    "result": [
        <Ranks Model>,
        <Ranks Model>,
        <Ranks Model>
    ]
}
GET

https://mnz.ee/rlrc/api/user/mmr/:playlist/:id?platform=:platform

Get users single playlist mmr value.
Playlist key must be one of the described playlist keys.

Example response

{
    "result": {
        "playlist":"standard",
        "value":1234
    }
}
GET

https://mnz.ee/rlrc/api/distribution/:playlist

Get playlist ranking distribution.
Playlist key must be one of the described playlist keys.

Example response

{
    "result": {
        "meta": {
            "playlist": "standard",
            "updated": 1619536793
        },
        "distribution": {
            "Unranked": {
                "Division I": <Distribution Model>
            },
            "Bronze I": {
                "Division I": <Distribution Model>,
                "Division II": <Distribution Model>,
                "Division III": <Distribution Model>,
                "Division IV": <Distribution Model>
            },
            "Bronze II": {
                "Division I": <Distribution Model>,
                "Division II": <Distribution Model>,
                "Division III": <Distribution Model>,
                "Division IV": <Distribution Model>
            },
            ...
            Every single key from <Tier>
            ...
        }
    }
}
POST

https://mnz.ee/rlrc/api/users/stats/list

Get mutliple user stats at the same time, valid platforms can be used

Example body

{
    "steam": [
        "steam-id",
        "steam-id"
    ],
    "epic": [
        "epic-id"
    ]
}

Example response

{
    "result": [
        <Player Model>,
        <Player Model>,
        <Player Model>
    ]
}
POST

https://mnz.ee/rlrc/api/teams/create

Generate equal teams for custom tournaments.
All premade teams will be filled with randoms.
Premade teams use the same array as the random players array

List of valid comparissons

[
    "rank.standard",
    "rank.<any key from the Ranks Model>",
    "peak.seven",
    "peak.<any key from the Peaks Model>"
]

List of valid team sizes

[2, 3, 4]

There are multiple ways how to input the player arrays, all work the same way, this is an example with 1 premade team with 2 users and 4 randoms (for 3v3, 6 players total)

Example body

{
    "players": [
        {
            "primary_id": "steam-id",
            "platform": "steam"
        },
        {
            "id": "xbox-id",
            "platform": "xbox"
        },
        {
            "steam_id": "steam-id",
        },
        {
            "epic_id": "steam-id",
        },
    ],
    "premades": {
        "team-1": [
            {
                "primary_id": "steam-id",
                "platform": "steam"
            },
            {
                "xbox_id": "xbox-id"
            }
        ]
    },
    "comparison": "peak.thirty",
    "teamsize": 3
}

Example response

{
    "result": [
        {
            "players": [
                <Player Model>,
                <Player Model>,
                <Player Model>
            ],
            "index": "team-1",
            "mmr_total": 2468,
            "mmr_average": 1234
        },
        {
            "players": [
                <Player Model>,
                <Player Model>,
                <Player Model>
            ],
            "index": "team-2",
            "mmr_total": 2468,
            "mmr_average": 1234
        }
    ]
}

JS lib download

Rank icons download

Skeleton stylesheet download

Use to setup a simple webpage

document.body.onload = function() {
  // set your app id (cannot be used without app_id)
  const app_id = 'your_app_id';
  if (window.RLRankCollector != null) {

    // default options
    const options = {
      stylesheet: null,
      rank_icons_url: 'img/rlranks/',
      rank_icons_ext: 'png'
    };
    const rlrc = new RLRankCollector(app_id, document.getElementById("wrapper"), options);
  } else {
    window.alert('Error loading RLRC');
  }
}

Notice!

Options to get the UI working out of the box:

{
  const options = {
    stylesheet: 'https://mnz.ee/rlrc/lib/rlrc.min.css',
    rank_icons_url: 'http://mnz.ee/rlrc/app/img/rlranks/'
  };
}

Use with nodeJS

Note: All API function return a promise

Note: Setting app_id and the whole auth is optional

PS! change from ver 1 to new version that includes ranks for all platforms:

const RLRC = require('./../rlrc/lib/rlrc.min.js').API;

// The library needs a global fetch
global.fetch = require('node-fetch');


// setting app_id is optional, only needed to modify data
// auth.login, user.add, user.remove, user.update and users.list cannot be used without app_id
// stats, details and team building is avaiable without auth
const app_id = 'your_app_id';
RLRC.init(app_id);

// auth process (optional):
const token = your_saved_session_token || null;

// if token is set, check for validity
if (token != null) {

    // set token
  RLRC.setToken(token);

  // check for status
  RLRC.auth.status().then((status) => {
    if (status) {
      // user is authendicated
    }
  });
}

// login, where secret is your app_id password
RLRC.auth.login(secret)
.then((token) => { /** login successfull, save token if needed */ }).
.catch(() => { /** login failed */});

// logout current user
RLRC.auth.logout().then(() => { /** clear any tokens or other information */ });
// auth process end

// get single user and save it to your app id user bank
RLRC.user.stats.get(steam_id).then((user) => { /** user info */ });
RLRC.user.stats.steam(steam_id).then((user) => { /** user info */ });
RLRC.user.stats.epic(epic_id).then((user) => { /** user info */ });
RLRC.user.stats.xbox(xbox_id).then((user) => { /** user info */ });
RLRC.user.stats.psn(psn_id).then((user) => { /** user info */ });
RLRC.user.stats.switch(switch_id).then((user) => { /** user info */ });

// if you dont have user bank but want to use the api, set option auth to false
RLRC.user.stats.get(steam_id).then((user) => { /** user info */ });
RLRC.user.stats.steam(steam_id).then((user) => { /** user info */ });
RLRC.user.stats.epic(epic_id).then((user) => { /** user info */ });
RLRC.user.stats.xbox(xbox_id).then((user) => { /** user info */ });
RLRC.user.stats.psn(psn_id).then((user) => { /** user info */ });
RLRC.user.stats.switch(switch_id).then((user) => { /** user info */ });

// get single user details
RLRC.user.details.get(steam_id).then((details) => { /** user detailed info */ });

// get app list of users
RLRC.users.list().then((users) => { /** list of users */ });

// get distribution information
RLRC.distribution.standard().then((distribution) => { /** distribution */});
RLRC.distribution.doubles().then((distribution) => { /** distribution */});
RLRC.distribution.duel().then((distribution) => { /** distribution */});
RLRC.distribution.tournament().then((distribution) => { /** distribution */});
RLRC.distribution.hoops().then((distribution) => { /** distribution */});
RLRC.distribution.dropshot().then((distribution) => { /** distribution */});
RLRC.distribution.rumble().then((distribution) => { /** distribution */});
RLRC.distribution.snowday().then((distribution) => { /** distribution */});

// Teams

// start by calling begin
// defaults: comparison: 'peak.thirty', teamsize: 3
const generator = RLRC.teams.begin(comparison, teamsize);

// add random player to the teams list (platform can be either steam, epic, xbox, psn or switch, default: steam)
generator.random(id, platform);

// get team object for premad teams
// team_index is optional, if not given it will be generated automatically by n teams + 1, will act as a getter if given
const team_index = 'team-1';
const team = generator.get(team_index)

// add player under that team (platform can be either steam, epic, xbox, psn or switch, default: steam)
team.add(id, platform);

// finally build the teams
generator.build().then((teams) => { /** do something with the teams */});

// TLDR; version of team building
const generator = RLRC.teams.begin();

if (message.value === 'random') {
  generator.random(message.user.steam_id, "steam");
} else {
  const team = generator.get()

  // match syntax eg team name 420 (c) captain, teammate, random
  const regexp = new RegExp('[a-zA-Z0-9 ()-._]+\\s\\(c\\)\\s?([a-zA-Z0-9 -._]+),\\s?([a-zA-Z0-9 -._]+),\\s?([a-zA-Z0-9 -._]+)', 'i');
  const matches = message.value.match(regexp);
  for (let i = 1; i < matches.length; i++) {
    const user = matches[i];
    if (user !== 'random') {
      team.add(user.steam_id, "steam");
    }
  }
}

generator.build().then((teams) => { /** do something with the teams */});