Skip to content

API ​

Intro ​

   

About ​

API made in nodejs connected through mongoose to a mongodb database hosted in a mongodb Atlas cluster.

Project hosted in Heroku.

Color code ​

RGB #a61a5e  rgb(166, 26, 94) / sRGB #c21360  rgb(194, 19, 96)

Used ​

  • Nodejs
  • MongoDB Atas Cluster - site
  • Heroku - site
  • Discord OAuth2

Other ​

  • Robo3T
  • MongoDB Compass
  • Postman
  • CircleCI

Dependencies ​

  • Express
  • body-parser
  • dotenv
  • btoa
  • dotenv - docs
  • mongoose
  • nanoid - docs
  • nodemon - site

Check page ​

https://api.disboard.team

Repository private ​

https://github.com/Qu4k3/disboard-api

Players ​

Resource description /players ​

METHODPATHDESCRIPTION
GET/playersRetrieve a list of all players
GET/players/:playerIdRetrieve a specific player by it's ID *check note
POST/playersAdd a new player to database
PUT/players/:playerIdEdit information from a specific player
DEL/players/:playerIdDelete a player

NOTE

:playerId can be both the user's ID provided by the app or its Discord unique ID

PERMISSIONS

Some routes are autenticated and will not be available for public

Endpoints and methods /players ​

Parameters /players ​

Request example /players ​

Response example and schema /players ​

json
{
    "player_id" : String, // Player ID
    "player_name" : String, // Player nickname
    "player_team" : String, // Refer to team's Id
    "country" : {
        "name" : String, // Country
        "code" : String // Country code
    },
    "player_registry" : [
        {
            "role" : String, // Role type (ex: member, ally, trial)
            "in" : Date, // join date
            "out" : Date, // leave date
        }
    ],
    "discord" : {
        "unique_id" : String, // Discord unique Id
        "user_tag" : String, // Discord user tag
        "avatar_url" : String, // Discord's user profile picture
        "roles" : [
            {
                "role" : String, // Discord role
                "role_color" : String // Discord role color in hexadecimal
            }
        ]
    },
    "switch_fc" : String, // Nintendo Switch's friend code
    "mkc_player_profile" : String // mkc team link (ex: https://www.mariokartcentral.com/mkc/players/10)
}

Teams ​

Resource description /teams ​

METHODPATHDESCRIPTION
GET/teamsRetrieve a list of all teams
GET/teams/Retrieve a specific team by it's ID
POST/teamsAdd a new team to database
PUT/teams/Edit information from a specific team
DEL/teams/Delete a team

PERMISSIONS

Some routes are autenticated and will not be available for public

Endpoints and methods /teams ​

Parameters /teams ​

Request example /teams ​

Response example and schema /teams ​

json
{
    "team_id" : String, // Team unique ID
    "team_name" : String, // Team name
    "team_tag" : String, // Team tag
    "team_logo" : String, // direct image link
    "mkc_team_profile" : String // mkc team link (ex: https://www.mariokartcentral.com/mkc/teams/42)
}

s

Resource description /wars ​

METHODPATHDESCRIPTION
GET/warsRetrieve a list of all wars
GET/wars/:warIdRetrieve a specific war by it's ID
POST/warsAdd a new war to database
PUT/wars/:warIdEdit inforamation
DEL/wars/:warIdDelete a war

PERMISSIONS

Some routes are autenticated and will not be available for public

Endpoints and methods /wars ​

Parameters /wars ​

Request example /wars ​

Response example and schema /wars ​

json
{
    "war_id": String, // War unique ID
    "played_at" : Date, // Date where the war was played
    "game" : {
        "name" : String, // Game's code --default: MK8D
        "mode" : String // Game's mode code --default: 150cc
    },
    "type" : String, // Type of game played --default: friendly
    "tags" : [
        String // Tags to make wars groups or associations
    ],
    "results" : [
        {
            "team" : ObjectId, // Refer to team Id
            "host" : Boolean, // Define if the team is hosting the game
            "score" : Number, // Team final score
            "penality" : Number, // Penality points
            "players" : [
                {
                    "player" : ObjectId, // Refer to player Id
                    "score" : Number // player score
                }
            ]
        },
        {
            "team" : ObjectId, // Refer to team's Id
            "host" : Boolean, // Define if the team is hosting the game
            "score" : Number, // Team final score
            "penality" : Number, // Penality points
            "players" : [
                {
                    "player" : String, // Player name
                    "score" : Number // player score
                }
            ]
        }
    ]
}