WEB API

Web API allows you to get information from servers, as well as send signals from outside.
Make sure that the web server is enabled in the Skcrew settings of your proxy server (see sockets setup ).

web-server-enabled: true
web-server-port: 1338
web-server-user: admin
web-server-password: admin

Here you can also configure the web server port and its authorization data to access the API.
Authorization is performed by passing the username and password to base64 in the request header.

Create a base64 authentication string by visiting base64encode.org and encoding the following format in the encoding field:

username:password

This format will help you generate a properly formatted base64 string.

Now, you can use the following header (replace YOUR-BASE64-AUTHENTICATION-STRING with the base64 authentication string):

Authorization: Basic YOUR-BASE64-AUTHENTICATION-STRING

Examples

In the following examples, we used “admin:admin” as the base64 authentication string.
Eg. the username is “admin” and the password is “admin”.

Available routes for requests.

GET    /players

Allows you to get a list of all players and the name of the server they are on.
Possible parameters:

  • server:string - allows you to get players from a specific server
curl localhost:1338/players -H "Authorization: Basic YWRtaW46YWRtaW4="
{
  "data": [
    {
      "name": "Lotzy",
      "uuid": "a0970e26-b9f4-3f73-bd06-ede16c390d34",
      "join_date": 1706008310,
      "time_played": 1089,
      "server_name": "lobby"
    }
  ]
}

GET    /players/{UUID/USERNAME}

Allows you to get a player, if they are online, by their username or UUID. As well as the server on which they are located.

curl localhost:1338/players/Lotzy -H "Authorization: Basic YWRtaW46YWRtaW4="
{
  "data": {
    "name": "Lotzy",
    "uuid": "a0970e26-b9f4-3f73-bd06-ede16c390d34",
    "join_date": 1706008310,
    "time_played": 2335,
    "server_name": "lobby",
    "server": {
      "name": "lobby",
      "address": "127.0.0.1",
      "port": 25565,
      "hostname": "127.0.0.1",
      "online": true,
      "connection_date": 1706008017,
      "uptime": 2628,
      "players_count": 1,
      "players": [
        {
          "name": "Lotzy",
          "uuid": "a0970e26-b9f4-3f73-bd06-ede16c390d34",
          "join_date": 1706008310,
          "time_played": 2335,
          "server_name": "lobby"
        }
      ]
    }
  }
}

GET  POST    /players/{UUID/USERNAME}/kick

Allows you to kick a player from a proxy server, by their username or UUID.
When using a POST request, you can specify the reason for the kick. The reason can be specified either in plain text, an AdventureAPI component ( Velocity ) or in ChatComponentAPI ( BungeeCord ) in JSON format.

curl localhost:1338/players/Lotzy/kick -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -d '"GET OUT!"'
{
  "data": "Player Lotzy kicked"
}

GET    /players/{UUID/USERNAME}/connect/{SERVER}

Allows you to move a player to another server, by their username or UUID.\

curl localhost:1338/players/Lotzy/connect/lobby -H "Authorization: Basic YWRtaW46YWRtaW4="
{
  "data": "Player Lotzy connected to server lobby"
}

GET    /servers

Get a list of all servers and players on them.
Possible parameters:

  • online:boolean - allows you to get only those servers that are online
curl localhost:1338/servers?online=true -H "Authorization: Basic YWRtaW46YWRtaW4="
{
  "data": [
    {
      "name": "lobby",
      "address": "127.0.0.1",
      "port": 25565,
      "hostname": "127.0.0.1",
      "online": true,
      "connection_date": 1706008017,
      "uptime": 2132,
      "players_count": 1,
      "players": [
        {
          "name": "Lotzy",
          "uuid": "a0970e26-b9f4-3f73-bd06-ede16c390d34",
          "join_date": 1706008310,
          "time_played": 1839,
          "server_name": "lobby"
        }
      ]
    }
  ]
}

POST    /servers/{SERVER}/signal

Allows you to send a signal to the connected server.
The signal itself is transmitted in the request body.

curl localhost:1338/servers/lobby/signal -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -d "{'signals':[{'key':'broadcast','data':['Hello world!']}]}"
{
  "data": {
    "response": "Signals successfully sended to servers"
  }
}

POST    /signal

Allows you to send a signal to the connected servers.
The signal itself and the list of servers are transmitted in the request body.

curl localhost:1338/servers/lobby/signal -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -d "{'servers':['lobby'],'signals':[{'key':'broadcast','data':['Hello world!']}]}"
{
  "data": {
    "response": "Signals successfully sended to servers"
  }
}

You can see an example of implementing API access in Python at this link