API/Server: Difference between revisions

From RetroMC
Jump to navigation Jump to search
Skull6 (talk | contribs)
m Skull6 moved page API/server to API/Server
Skull6 (talk | contribs)
m add categories
 
Line 204: Line 204:
}
}
</pre>
</pre>
[[Category:Server internals]]
[[Category:Guides]]

Latest revision as of 21:02, 4 September 2026

Back to API

This API page describes the endpoints under api.retromc.org/api/v1/server.

GET api.retromc.org/api/v1/server/players

Description

This endpoint retrieves the current player count, the maximum number of players, and detailed information about each player online on the RetroMC server.

HTTP Method

GET

Request Parameters

None.

Response Format

  • player_count (int): The current number of online players.
  • players (array): A list of objects, each representing an online player. Each object contains:
    • world_environment (string): The environment of the world the player is in.
    • world (string): The name of the world the player is in.
    • world_uuid (string): The UUID of the world the player is in.
    • name (string): The player's name.
    • x (double): The player's X coordinate.
    • y (double): The player's Y coordinate.
    • z (double): The player's Z coordinate.
    • display_name (string): The player's display name, with formatting codes.
    • uuid (string): The player's UUID.
  • max_players (int): The maximum number of players that can be online on the server.
  • error (boolean): Indicates whether there was an error processing the request.

Example Response

{
  "player_count": 7,
  "players": [
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "NolantheWise",
      "x": 3595.826182438679,
      "y": 79,
      "z": 11263.400089164146,
      "display_name": "§8[§cDonator§4++§8]§fNolantheWise§f§f",
      "uuid": "0c793e7f-4b0d-44a1-97b5-dfbf445358de"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "SapphicPuppy",
      "x": 14573.611347380005,
      "y": 7,
      "z": 2025.9099524425576,
      "display_name": "§f[§aCitizen§f]SapphicPuppy§f",
      "uuid": "34bec2b7-faea-465a-b851-e7daea539471"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "JeppsDoudid",
      "x": -13984.699999988079,
      "y": 67,
      "z": 6775.485096728297,
      "display_name": "§f[§aCitizen§f]JeppsDoudid§f",
      "uuid": "444a32ac-0a7b-42f1-8ac5-4a66f5fe9aff"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "Garsooon",
      "x": -4791.995808385358,
      "y": 99.46610926093814,
      "z": -1647.7623934769274,
      "display_name": "§f[§3Helper§f]§f~&5Garsooon§f",
      "uuid": "69aebc38-fe71-454f-b281-c1ec936ef4b0"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "Lunar_Ec1ipse",
      "x": 12883.237297332853,
      "y": 67,
      "z": 12219.86913122631,
      "display_name": "§6[§aCitizen§6]§fLunar_Ec1ipse§f",
      "uuid": "6c801d7f-876f-49df-a042-99ce5cca8836"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "AYoungJew69",
      "x": 12927.129332973122,
      "y": 61,
      "z": 5312.651226453099,
      "display_name": "§f[§bMystic§f]~§6AYoungJew69§f§f",
      "uuid": "96d9f05a-e7d6-4e17-88be-35610e8c4d0d"
    },
    {
      "world_environment": "NORMAL",
      "world": "retromc",
      "world_uuid": "957e3d83-9d39-4fa7-a1f8-5294af4e3ab9",
      "name": "64BrokenElytras",
      "x": 10898.368902312031,
      "y": 71,
      "z": 12186.997460237853,
      "display_name": "§8[§7Wanderer§8]§f64BrokenElytras§f",
      "uuid": "7bab9fc0-7975-48c0-86f3-9d46666be835"
    }
  ],
  "max_players": 100,
  "error": false
}

GET api.retromc.org/api/v1/server/chat

Description

This endpoint retrieves a list of recent chat messages from the RetroMC server.

HTTP Method

GET

Request Parameters

  • startUnixTime (optional, int): The Unix timestamp to start fetching chat messages from. If not provided, it defaults to fetching the most recent messages.

Response Format

  • unixTime (int): The current Unix timestamp at the server.
  • messages (array): A list of chat messages. Each message object contains:
    • code (string): A unique code for the message.
    • channel (string): The chat channel the message was sent in.
    • display_name (string): The display name of the user who sent the message, with formatting codes.
    • message (string): The text of the chat message.
    • uuid (string): The UUID of the user who sent the message.
    • username (string): The username of the user who sent the message.
    • timestamp (int): The Unix timestamp when the message was sent.
  • error (boolean): Indicates whether there was an error processing the request.
  • startUnixTime (int): The Unix timestamp used as the starting point for fetching chat messages.

Example Response

{
  "unixTime": 1711595379,
  "messages": [
    {
      "code": "1848120f",
      "channel": "global",
      "display_name": "§f[§3Helper§f]§f~§5Garsooon§f§f",
      "message": "wb",
      "uuid": "69aebc38-fe71-454f-b281-c1ec936ef4b0",
      "username": "Garsooon",
      "timestamp": 1711595366
    },
    {
      "code": "1507ee0f",
      "channel": "global",
      "display_name": "§f[§6Moderator§f]~§8blck§chrt§f§f",
      "message": "ty",
      "uuid": "183251d2-5cb1-4ed5-98dd-bba22b880f34",
      "username": "1blckhrt",
      "timestamp": 1711595369
    }
  ],
  "error": false,
  "startUnixTime": 0
}

GET api.retromc.org/api/v1/server/tps

Description

This endpoint retrieves TPS (ticks per second) averages for serveral durations of time.

HTTP Method

GET

Request Parameters

None.

Response Format

  • tps_5s (double): TPS average for the last 5 seconds.
  • tps_30s (double): TPS average for the last 30 seconds
  • tps_1m (double): TPS average for the last minute.
  • tps_5m (double): TPS average for the last 5 minutes.
  • tps_15m (double): TPS average for the last 15 minutes.
  • tps_30m (double): TPS average for the last 30 minutes.
  • tps_records (array): Unknown what this is for.
  • error (boolean): Indicates whether there was an error processing the request.

Example Response

{
  "tps_5m": 20.01084133059592,
  "tps_15m": 20.010586756250408,
  "tps_5s": 19.99981715139008,
  "tps_10m": 20.013433112730198,
  "tps_1m": 20.000635067233297,
  "error": false,
  "tps_30s": 20.002230253285965,
  "tps_records": []
}