MCRest

231 Downloads

MCRest

Minecraft REST API Bukkit plugin. This plugin let you can use RESTful API to manage your minecraft bukkit server.

Project Site: https://github.com/eternnoir/MCRest

How to Use

Start Server, you will see some log messages.

[11:10:14 INFO]: [McREST] Enabling McREST v0.1
[11:10:14 INFO]: [McREST] Enable
[11:10:14 INFO]: Starting the internal [HTTP/1.1] server on port 8281
[11:10:14 INFO]: [McREST] McRest start success.
[11:10:14 INFO]: [McREST] Listen on 0.0.0.0:8281/mcrest
[11:10:14 INFO]: Server permissions file permissions.yml is empty, ignoring it
[11:10:14 INFO]: Done (2.063s)! For help, type "help" or "?"

Now you can ues url to get some information.

APIs

/player

  • /player - Get all players list.
  • /player/<playerId> - Get player data by player id.
  • /player/<uuid> - Get player data by uuid.

/world

  • /world - Get all worlds list.

/whitelist

/server

/chat

  • /chat - Get last 100 chat messages.
  • /chat/<messageNum> - Get number of message.

Configuration


port: 8281 ## Which port you wnat to let plugin to listen.
prefix: mcrest ## Url routing for plugin. http://127.0.0.1:8281/mcrest
auth:  ## Config for Authentication
  enable: false  ## Use authentication
  user: mcrest   ## User name
  password: mcrest  ## Password
  protected:     ## Which APIs you want to use authentication
  - /
  - /player
  - /world

Players

Use cUrl test.

$ curl -X GET http://127.0.0.1:8281/mcrest/player

It will return all player in this server.

[
   {
      "name":"Maeksein",
      "uniqueId":"efc3d000-119c-4923-afcd-cb6ffafaaf08",
      "online":false,
      "whitelisted":false,
      "banned":false,
      "firstPlayed":1426216252338
   }
]

Worlds

$ curl -X GET http://127.0.0.1:8281/mcrest/world

It will return all world information in this server.

[
   {
      "allowAnimals":true,
      "allowMonsters":true,
      "gameRules":[
         "commandBlockOutput",
         "doDaylightCycle",
         "doFireTick",
         "doMobLoot",
         "doMobSpawning",
         "doTileDrops",
         "keepInventory",
         "logAdminCommands",
         "mobGriefing",
         "naturalRegeneration",
         "randomTickSpeed",
         "reducedDebugInfo",
         "sendCommandFeedback",
         "showDeathMessages"
      ],
      "name":"world",
      "players":[
         {
            "name":"Maeksein",
            "uniqueId":"efc3d000-119c-4923-afcd-cb6ffafaaf08",
            "online":true,
            "whitelisted":false,
            "banned":false,
            "firstPlayed":1426216252338,
            "dispalyName":"Maeksein"
         }
      ]
   },
   {
      "allowAnimals":true,
      "allowMonsters":true,
      "gameRules":[
         "commandBlockOutput",
         "doDaylightCycle",
         "doFireTick",
         "doMobLoot",
         "doMobSpawning",
         "doTileDrops",
         "keepInventory",
         "logAdminCommands",
         "mobGriefing",
         "naturalRegeneration",
         "randomTickSpeed",
         "reducedDebugInfo",
         "sendCommandFeedback",
         "showDeathMessages"
      ],
      "name":"world_nether",
      "players":[

      ]
   },
   {
      "allowAnimals":true,
      "allowMonsters":true,
      "gameRules":[
         "commandBlockOutput",
         "doDaylightCycle",
         "doFireTick",
         "doMobLoot",
         "doMobSpawning",
         "doTileDrops",
         "keepInventory",
         "logAdminCommands",
         "mobGriefing",
         "naturalRegeneration",
         "randomTickSpeed",
         "reducedDebugInfo",
         "sendCommandFeedback",
         "showDeathMessages"
      ],
      "name":"world_the_end",
      "players":[

      ]
   }
]