Core Server Internal API Specification - dapucita/haxbotron GitHub Wiki

Core Server Internal API Specification

The internal API should not be used outside the server.

JWT token(cookie) and admin account(user.username) information will be delivered when server networking.

API Version Root URL Description
v1 /api/v1/init Init Configuration APIs
v1 /api/v1/auth JWT Auth APIs
v1 /api/v1/room Control Room APIs
v1 /api/v1/system Server Information APIs
v1 /api/v1/playerlist Player List APIs
v1 /api/v1/superadmin Super Admin APIs
v1 /api/v1/banlist Ban List APIs
v1 /api/v1/ruidlist RUID List APIs

🌱 Init Configuration APIs

These APIs are used for initial configuration when the Core Server first runs.

🌱 Check if initialised

Request

Method Request URL Description
GET / Check if initialised

Response

Status Body Description
204 initialised already
404 not initialised yet (need for)

Result

404 status code will be returned if initial configuration is need.

🌱 Initial configuration

Request

Method Request URL Description
POST / Init the server

Request Body

Type Description Required
username: string Plain account name Yes
password: string Plain account password with 3-20 alphanum characters (not encrypted yet) Yes

Response

Status Body Description
201 Configuration succeeded
400 Configuration schema is unfulfilled
405 Already done

Result

After configuration succeeded, new admin account will be created.


🔑 JWT Auth APIs

These APIs are used to authenticate internal APIs. These manage and validate JWT token.

🔑 Login

Request

Method Request URL Description
POST / Login to admin account

Request Body

Type Description Required
username: string Plain account name Yes
password: string Plain account password with 3-20 alphanum characters (not encrypted yet) Yes

Response

Status Body Description
201 Login succeeded
401 Login failed
501 Server errors

Result

After login succeeded, JWT token will be insterted into cookie. (maxAge: 7d)

🔑 Logout

Request

Method Request URL Description
DELETE / Logout from admin account

Response

Status Body Description
204 Logout succeeded

Result

After logout succeeded, the cookie will be reset.

🔑 Check if authorized

Request

Method Request URL Description
GET / Check if loginned

Response

Status Body Description
200 user.username accepted
401 rejected

Result

After verified, username field in the user object from JWT token will be returned.


đŸ“Ļ Control Room APIs

These APIs are used to manage and control the game rooms. Login is required.

đŸ“Ļ Create new game room

Request

Method Request URL Description
POST / Create new game room

Request Body

Type Description Required
ruid ruid of new game room Yes
_config configuration of game room Yes
settings game room settings Yes
rules game operating rules Yes
helo rating and tier system configuration Yes
commands game commands configuration Yes

More information for each types are available in here.

Response

Status Body Description
201 The game room is created successfully
400 Configuration schema is unfulfilled
401 rejected
409 Same game room ruid exists

Result

New room will be created if same ruid doesn't exist.

đŸ“Ļ Close the game room

Request

Method Request URL Description
DELETE /:ruid Close the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Closed the game room
401 rejected
404 No game room exists

đŸ“Ļ Get a list of exist game rooms

Request

Method Request URL Description
GET / Get all list of exist game rooms

Response

Status Body Description
200 ruid: string[] List of exist game rooms
401 rejected
404 No game rooms exist

đŸ“Ļ Get information of the game room

Request

Method Request URL Description
GET /:ruid Get information of the game room ruid

Response

Status Body Description
200 { roomName: string, onlinePlayers: number } Information of the game room
401 rejected
404 No game room exists

đŸ“Ļ Get detail information of the game room

Request

Method Request URL Description
GET /:ruid/info Get detail information of the game room ruid

Response

Status Body Description
200 DetailRoomInfo object Detail information of the game room
401 rejected
404 No game room exists

See more information about DetailRoomInfo object in here.

đŸ“Ļ Get all list of online players

Request

Method Request URL Description
GET /:ruid/player Get all list of online players in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 id: number[] List of online players
401 rejected
404 No game rooms exist

đŸ“Ļ Get player's info

Request

Method Request URL Description
GET /:ruid/player/:id Get info of the player in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Response

Status Body Description
200 Player object Player information
401 rejected
404 No exists

See more information about Player object in here.

đŸ“Ļ Check Player Muted

Request

Method Request URL Description
GET /:ruid/player/:id/permission/mute Get mute status of the player in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Response

Status Body Description
200 mute: Boolean, muteExpire: Number Mute status
401 rejected
404 No exists

đŸ“Ļ Mute the Player

Request

Method Request URL Description
POST /:ruid/player/:id/permission/mute Mute the player in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Request Body

Type Description Required
muteExpire: Number Expiration time as Unix Timestamp Yes

Response

Status Body Description
204 Success
400 Request body is unfulfilled
401 rejected
404 No exists

đŸ“Ļ Unmute the Player

Request

Method Request URL Description
DELETE /:ruid/player/:id/permission/mute Unmute the player in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Response

Status Body Description
204 Success
401 rejected
404 No exists

đŸ“Ļ Fixed-term Ban the Player

Request

Method Request URL Description
DELETE /:ruid/player/:id Fixed-term Ban the player in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Request Body

Type Description Required
ban: Boolean Ban or Kick (Kick is recommended) Yes
seconds: Number Duration Yes
message: String Ban Reason Yes

Response

Status Body Description
204 Success
401 rejected
404 No exists

đŸ“Ļ Check Chat Freezed

Request

Method Request URL Description
GET /:ruid/info/freeze Get freeze status of the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 freezed: Boolean Freeze status
401 rejected
404 No exists game room

đŸ“Ļ Freeze Chat

Request

Method Request URL Description
POST /:ruid/info/freeze Freeze whole chat in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Success
401 rejected
404 No exists game room

đŸ“Ļ Unfreeze Chat

Request

Method Request URL Description
DELETE /:ruid/info/freeze Unfreeze whole chat in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Success
401 rejected
404 No exists game room

đŸ“Ļ Broadcast (Send Message)

Request

Method Request URL Description
POST /:ruid/chat Send chat message to the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
message Text message Yes

Response

Status Body Description
201 Broadcast completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

đŸ“Ļ Whisper (Send Message)

Request

Method Request URL Description
POST /:ruid/chat/:id Send chat message to the specific player

Request Parameter

Name Description
ruid Target room's ruid
id Target player's id

Request Body

Type Description Required
message Text message Yes

Response

Status Body Description
201 Message is sent
400 Request body is unfulfilled
401 Rejected
404 No exists game room or player

đŸ“Ļ Get Discord Webhook Configuration

Request

Method Request URL Description
GET /:ruid/social/discord/webhook Get Discord webhook configuration from the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 config configuration data
401 rejected
404 No exists

See more information about config part in here.

đŸ“Ļ Set Discord Webhook Configuration

Request

Method Request URL Description
POST /:ruid/social/discord/webhook Get Discord webhook configuration from the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
config configuration data Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

See more information about config part in here.

đŸ“Ļ Get Notice

Request

Method Request URL Description
GET /:ruid/social/notice Get notice message from the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 message: string Text message
401 rejected
404 No exists

đŸ“Ļ Set Notice

Request

Method Request URL Description
POST /:ruid/social/notice Set notice message to the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
message Text message Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

đŸ“Ļ Delete Notice

Request

Method Request URL Description
DELETE /:ruid/social/notice Delete notice message from the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Delete completed
401 Rejected
404 No exists game room

đŸ“Ļ Set Password

Request

Method Request URL Description
POST /:ruid/info/password Set password for the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
password Plain Password Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

đŸ“Ļ Delete Password

Request

Method Request URL Description
DELETE /:ruid/info/password Clear password from the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Clear completed
401 Rejected
404 No exists game room

đŸ“Ļ Get Nickname Filtering Pool

Request

Method Request URL Description
GET /:ruid/filter/nickname Get nickname filtering pool for the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 pool: string Banned words seperated by |,|
401 rejected
404 No exists game room

đŸ“Ļ Get Chat Filtering Pool

Request

Method Request URL Description
GET /:ruid/filter/chat Get chat filtering pool for the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 pool: string Banned words seperated by |,|
401 rejected
404 No exists game room

đŸ“Ļ Set Nickname Filter

Request

Method Request URL Description
POST /:ruid/filter/nickname Set Nickname filter for the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
pool Plain Text includes banned words sperated by |,| Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

đŸ“Ļ Set Chat Filter

Request

Method Request URL Description
POST /:ruid/filter/chat Set Chat filter for the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
pool Plain Text includes banned words sperated by |,| Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room

đŸ“Ļ Delete Nickname Filter

Request

Method Request URL Description
DELETE /:ruid/filter/nickname Delete Nickname filter from the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Delete completed
401 Rejected
404 No exists game room

đŸ“Ļ Delete Chat Filter

Request

Method Request URL Description
DELETE /:ruid/filter/chat Delete Chat filter from the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
204 Delete completed
401 Rejected
404 No exists game room

đŸ“Ļ Get Team Colours

Request

Method Request URL Description
GET /:ruid/asset/team/colour Get team colours from the game room

Request Parameter

Name Description
ruid Target room's ruid

Response

Status Body Description
200 red: TeamColours, blue: TeamColours Team colours data
401 rejected
404 No exists game room

See more information about TeamColours object in here.

đŸ“Ļ Set Team Colours

Request

Method Request URL Description
POST /:ruid/asset/team/colour Set team colours for the game room

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
team: number 1 for Red or 2 for Blue Yes
angle: number angle for the team color stripes (in degrees) Yes
textColour: number color of the player avatars Yes
teamColour1: number first color for the team Yes
teamColour2: number second color for the team Yes
teamColour3: number third color for the team Yes

Response

Status Body Description
201 Set completed
400 Request body is unfulfilled
401 Rejected
404 No exists game room or wrong team ID

đŸ–Ĩī¸ Server Information APIs

These APIs are used for investigate server and system information. Login is required.

đŸ–Ĩī¸ Get server information

Request

Method Request URL Description
GET / Get server and system information.

Response

Status Body Description
200 ServerInfo Object Server Information
401 rejected

See more information about ServerInfo object in here.


⛹ī¸ Player List APIs

These APIs are for CRUD Player Account List. Login is required.

⛹ī¸ Get all player accounts

Request

Method Request URL Description
GET /:ruid Get all player accounts in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Request Query

Name Description
start starting index for pagination
count items count for pagination

Response

Status Body Description
200 PlayerStorage[] object Player accounts with information
401 rejected
404 No game rooms exist

See more information about PlayerStorage object in here.

⛹ī¸ Get player's info

Request

Method Request URL Description
GET /:ruid/:auth Find the player in the game room :ruid with :auth and get the account information

Request Parameter

Name Description
ruid Target room's ruid
auth Target player account's auth

Response

Status Body Description
200 PlayerStorage object Player information
401 rejected
404 No exists

See more information about PlayerStorage object in here.


🔐 Super Admin APIs

These APIs are for CRUD Superadmin key. Login is required.

🔐 Get all superadmin data

Request

Method Request URL Description
GET /:ruid Get all superadmin data from game room :ruid

Request Query

Name Description
start starting index for pagination
count items count for pagination

Response

Status Body Description
200 { key: String, description: String }[]
404 no data

🔐 Register superadmin key

Request

Method Request URL Description
POST /:ruid Register superadmin key to game room `:ruid

Request Body

Type Description Required
key: string Yes
description: string Yes

Response

Status Body Description
204 created
400 failed

🔐 Delete superadmin key

Request

Method Request URL Description
DELETE /:ruid/:key Delete superadmin key :key from game room `:ruid

Response

Status Body Description
204 deleted
400 failed

đŸšĢ Ban List APIs

These APIs are for CRUD Ban List. Login is required.

đŸšĢ Get all BanList

Request

Method Request URL Description
GET /:ruid Get all ban list from game room :ruid

Request Parameter

Name Description
ruid Target room's ruid

Request Query

Name Description
start starting index for pagination
count items count for pagination

Response

Status Body Description
200 { conn: String, reason: String, register: Number, expire: Number }[]
404 no data

đŸšĢ Get ban information

Request

Method Request URL Description
GET /:ruid/:conn Get ban information in the game room :ruid

Request Parameter

Name Description
ruid Target room's ruid
conn Target player's conn

Response

Status Body Description
200 { conn: String, reason: String, register: Number, expire: Number } Player information
401 rejected
404 No exists

đŸšĢ Add Ban List

Request

Method Request URL Description
POST /:ruid Ban from game room `:ruid

Request Parameter

Name Description
ruid Target room's ruid

Request Body

Type Description Required
conn: string Yes
reason: string Yes
seconds: number Yes

Response

Status Body Description
204 registered
400 failed

đŸšĢ Delete from Ban List

Request

Method Request URL Description
DELETE /:ruid/:conn Unban :conn from game room `:ruid

Request Parameter

Name Description
ruid Target room's ruid
conn Target player's conn

Response

Status Body Description
204 deleted
400 failed

📜 RUID List APIs

These APIs are for get RUIDs list saved on DB server. Login is required.

📜 Get all RUIDs list

This API will return all RUIDs list, not only online rooms' RUIDs.

So it also returns all RUIDs that were previously used.

In order for a RUID to be saved, at least one player must have accessed that game room.

Request

Method Request URL Description
GET / Get all RUID list saved on DB server

Response

Status Body Description
200 { ruid: String }[] Exist RUIDs on DB server
404 no data