Skip to content

Repository files navigation

Web-API - Java Client

Access Sponge powered Minecraft servers through a WebAPI

Introduction

This is the documentation of the various API routes offered by the WebAPI plugin.
This documentation assumes that you are familiar with the basic concepts of Web API's, such as GET, PUT, POST and DELETE methods, request HEADERS and RESPONSE CODES and JSON data.
By default this documentation can be found at http:/localhost:8080 (while your minecraft server is running) and the various routes start with http:/localhost:8080/api/v5...
As a quick test try reaching the route http:/localhost:8080/api/v5/info (remember that you can only access \"localhost\" routes on the server on which you are running minecraft). This route should show you basic information about your server, like the motd and player count.

List endpoints

Lots of objects offer an endpoint to list all objects (e.g. GET: /world to get all worlds). These endpoints return only the properties marked 'required' by default, because the list might be quite large. If you want to return ALL data for a list endpoint add the query parameter details, (e.g. GET: /world?details).

Remember that in this case the data returned by the endpoint might be quite large.

Debugging endpoints

Apart from the ?details flag you can also pass some other flags for debugging purposes. Remember that you must include the first query parameter with ?, and further ones with &:

  • details: Includes details for list endpoints
  • accept=[json/xml]: Manually set the accept content type. This is good for browser testing, BUT DON'T USE THIS IN PRODUCTION, YOU CAN SUPPLY THE Accepts HEADER FOR THAT
  • pretty: Pretty prints the data, also good for debugging in the browser.

An example request might look like this: http://localhost:8080/api/v5/world?details&accpet=json&pretty&key=MY-API-KEY

Additional data

Certain endpoints (such as /player, /entity and /tile-entity have additional properties which are not documented here, because the data depends on the concrete object type (eg. Sheep have a wool color, others do not) and on the other plugins/mods that are running on your server which might add additional data.
You can also find more information in the github docs (https:/github.com/Valandur/Web-API/tree/master/docs/DATA.md)

Swagger

Web-API

  • API version: 5.4.2-S7.1.0
    • Build date: 2019-07-23T13:32:53.543+02:00

Automatically generated by the Swagger Codegen

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.swagger:swagger-java-client:1.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/swagger-java-client-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

importio.swagger.client.*;
importio.swagger.client.auth.*;
importio.swagger.client.model.*;
importio.swagger.client.api.ActiveTimeApi;
importjava.io.File;
importjava.util.*;
publicclassActiveTimeApiExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ApiKeyHeaderApiKeyAuthApiKeyHeader = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyHeader");
ApiKeyHeader.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//ApiKeyHeader.setApiKeyPrefix("Token");// Configure API key authorization: ApiKeyQueryApiKeyAuthApiKeyQuery = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyQuery");
ApiKeyQuery.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//ApiKeyQuery.setApiKeyPrefix("Token");ActiveTimeApiapiInstance = newActiveTimeApi();
Booleandetails = true; // Boolean | Add to include additional details, omit or false otherwiseStringaccept = "accept_example"; // String | Override the 'Accept' request header (useful for debugging your requests)Booleanpretty = true; // Boolean | Add to make the Web-API pretty print the response (useful for debugging your requests)try {
ServerReportresult = apiInstance.getServerReport(details, accept, pretty);
System.out.println(result);
} catch (ApiExceptione) {
System.err.println("Exception when calling ActiveTimeApi#getServerReport");
e.printStackTrace();
}
}
}

Documentation for API Endpoints

All URIs are relative to https://localhost/api/v5

ClassMethodHTTP requestDescription
ActiveTimeApigetServerReportGET /active-timeServer report
ActiveTimeApigetUserReportGET /active-time/user/{uuid}User report
BlockApicreateBlockOperationPOST /block/opCreate a block operation
BlockApideleteBlockOperationDELETE /block/op/{uuid}Stop a block operation
BlockApigetBlockGET /block/{world}/{x}/{y}/{z}Get a block
BlockApigetBlockOperationGET /block/op/{uuid}Get a block operation
BlockApilistBlockOperationsGET /block/opList block operations
BlockApimodifyBlockOperationPUT /block/op/{uuid}Modify a block operation
ChunkApicreateChunkAtPOST /chunk/{world}/{x}/{z}Load & Generate a chunk
ChunkApigetChunkAtGET /chunk/{world}/{x}/{z}Get a chunk
ChunkApilistChunksGET /chunk/{world}List chunks
CmdSchedulerApideleteTaskDELETE /cmd-scheduler/{name}Delete a task
CmdSchedulerApilistTasksGET /cmd-schedulerList tasks
CommandApigetCommandGET /cmd/{cmd}Get a command
CommandApilistCommandsGET /cmdList commands
CommandApirunCommandsPOST /cmdExecute a command
EconomyApigetAccountGET /economy/account/{id}List currencies
EconomyApigetCurrenciesGET /economy/currencyList currencies
EntityApicreateEntityPOST /entitySpawn an entity
EntityApiexecuteMethodPOST /entity/{entity}/methodExecute a method
EntityApigetEntityGET /entity/{entity}Get entity
EntityApilistEntitiesGET /entityList entities
EntityApimodifyEntityPUT /entity/{entity}Modify an entity
EntityApiremoveEntityDELETE /entity/{entity}Destroy an entity
HistoryApigetChatGET /history/messageGet message history
HistoryApigetCommandsGET /history/cmdGet command history
InfoApigetInfoGET /infoServer info
InfoApigetStatsGET /info/statsServer stats
InfoApilistServletsGET /info/servletsList servlets
InteractiveMessageApigetMessageGET /interactive-message/{uuid}Get a message
InteractiveMessageApilistMessagesGET /interactive-messageList messages
InteractiveMessageApisendMessagePOST /interactive-messageSend a message
InventoryApiaddElementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
InventoryApicloseRendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
InventoryApicreateMenuPOST /megamenus/menuCreate menu
InventoryApicreateRendererPOST /megamenus/render/{mid}Create menu
InventoryApideleteElementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
InventoryApideleteMenuDELETE /megamenus/menu/{mid}Delete menu
InventoryApideletePageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
InventoryApideleteRendererDELETE /megamenus/renderer/{mid}Delete menu
InventoryApifindRendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
InventoryApigetElementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
InventoryApigetMenuGET /megamenus/menu/{mid}Get menu
InventoryApigetPageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
InventoryApigetRendererGET /megamenus/render/{mid}Get the renderer for this menu
InventoryApilistMenusGET /megamenus/menuList menus
InventoryApilistRendererGET /megamenus/renderList renderer
InventoryApiopenRendererPUT /megamenus/render/{mid}/{viewer}Open renderer
InventoryApisetElementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
InventoryApisetMenuPUT /megamenus/menu/{mid}Update menu
MapApigetMapGET /map/{world}/{x}/{z}Get a map tile
MegaMenusApiaddElementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
MegaMenusApicloseRendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
MegaMenusApicreateMenuPOST /megamenus/menuCreate menu
MegaMenusApicreateRendererPOST /megamenus/render/{mid}Create menu
MegaMenusApideleteElementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
MegaMenusApideleteMenuDELETE /megamenus/menu/{mid}Delete menu
MegaMenusApideletePageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
MegaMenusApideleteRendererDELETE /megamenus/renderer/{mid}Delete menu
MegaMenusApifindRendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
MegaMenusApigetElementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
MegaMenusApigetMenuGET /megamenus/menu/{mid}Get menu
MegaMenusApigetPageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
MegaMenusApigetRendererGET /megamenus/render/{mid}Get the renderer for this menu
MegaMenusApilistMenusGET /megamenus/menuList menus
MegaMenusApilistRendererGET /megamenus/renderList renderer
MegaMenusApiopenRendererPUT /megamenus/render/{mid}/{viewer}Open renderer
MegaMenusApisetElementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
MegaMenusApisetMenuPUT /megamenus/menu/{mid}Update menu
MenuApiaddElementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
MenuApicloseRendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
MenuApicreateMenuPOST /megamenus/menuCreate menu
MenuApicreateRendererPOST /megamenus/render/{mid}Create menu
MenuApideleteElementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
MenuApideleteMenuDELETE /megamenus/menu/{mid}Delete menu
MenuApideletePageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
MenuApideleteRendererDELETE /megamenus/renderer/{mid}Delete menu
MenuApifindRendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
MenuApigetElementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
MenuApigetMenuGET /megamenus/menu/{mid}Get menu
MenuApigetPageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
MenuApigetRendererGET /megamenus/render/{mid}Get the renderer for this menu
MenuApilistMenusGET /megamenus/menuList menus
MenuApilistRendererGET /megamenus/renderList renderer
MenuApiopenRendererPUT /megamenus/render/{mid}/{viewer}Open renderer
MenuApisetElementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
MenuApisetMenuPUT /megamenus/menu/{mid}Update menu
PermissionApigetCollectionGET /permission/collection/{id}Get collection
PermissionApigetSubjectGET /permission/collection/{id}/subject/{subId}Get subject
PermissionApilistCollectionsGET /permission/collectionList collections
PermissionApilistSubjectsGET /permission/collection/{id}/subjectList subjects
PlayerApiexecuteMethodPOST /player/{player}/methodExecute a method
PlayerApigetPlayerGET /player/{player}Get a player
PlayerApilistPlayersGET /playerList players
PlayerApimodifyPlayerPUT /player/{player}Modify a player
PluginApichangePluginConfigPOST /plugin/{plugin}/configChange plugin configs
PluginApigetPluginGET /plugin/{plugin}Get a plugin
PluginApigetPluginConfigGET /plugin/{plugin}/configGet plugin configs
PluginApilistPluginsGET /pluginList plugins
PluginApitogglePluginPUT /plugin/{plugin}Toggle a plugin
RecipeApilistRecipesGET /recipeList recipes
RedProtectApicreateRegionPOST /red-protect/regionCreate a region
RedProtectApideleteRegionDELETE /red-protect/region/{id}Delete a region
RedProtectApigetRegionGET /red-protect/region/{id}Get a region
RedProtectApilistRegionsGET /red-protect/regionList regions
RedProtectApimodifyRegionPUT /red-protect/region/{id}Modify a region
RegistryApigetRegistryGET /registry/{class}Get a catalog type
ServerApilistPropertiesGET /server/propertiesList server properties
ServerApimodifyPropertiesPUT /server/propertiesModify server properties
TileEntityApiexecuteMethodPOST /tile-entity/{world}/{x}/{y}/{z}/methodExecute a method
TileEntityApigetTileEntityGET /tile-entity/{world}/{x}/{y}/{z}Get tile entity
TileEntityApilistTileEntitiesGET /tile-entityList tile entities
TileEntityApimodifyTileEntityPUT /tile-entity/{world}/{x}/{y}/{z}Modify tile entity
UiApiaddElementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
UiApicloseRendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
UiApicreateMenuPOST /megamenus/menuCreate menu
UiApicreateRendererPOST /megamenus/render/{mid}Create menu
UiApideleteElementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
UiApideleteMenuDELETE /megamenus/menu/{mid}Delete menu
UiApideletePageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
UiApideleteRendererDELETE /megamenus/renderer/{mid}Delete menu
UiApifindRendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
UiApigetElementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
UiApigetMenuGET /megamenus/menu/{mid}Get menu
UiApigetPageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
UiApigetRendererGET /megamenus/render/{mid}Get the renderer for this menu
UiApilistMenusGET /megamenus/menuList menus
UiApilistRendererGET /megamenus/renderList renderer
UiApiopenRendererPUT /megamenus/render/{mid}/{viewer}Open renderer
UiApisetElementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
UiApisetMenuPUT /megamenus/menu/{mid}Update menu
UniversalMarketApilistMarketItemsGET /universal-market/itemList items
UserApicreateUserPOST /userCreate a user
UserApideleteUserDELETE /user/{name}Delete a user
UserApigetMeGET /user/meCheck info
UserApigetUsersGET /userList users
UserApiloginPOST /user/loginLogin
UserApilogoutPOST /user/logoutLogout
UserApilogoutRedirectGET /user/logout
UserApimodifyUserPUT /user/{name}Update a user
VShopsApiaddShopItemPOST /vshop/shop/{id}/itemAdd Shop Item
VShopsApicreateShopPOST /vshop/shopCreate Shops
VShopsApideleteShopDELETE /vshop/shop/{id}Delete a Shop
VShopsApideleteShopItemDELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VShopsApigetShopGET /vshop/shop/{id}Get a Shop
VShopsApigetShopItemGET /vshop/shop/{id}/item/{item}Get a Shop
VShopsApilistShopItemsGET /vshop/shop/{id}/itemList Shop Items
VShopsApilistShopsGET /vshop/shopList Shops
VShopsApiupdateShopPUT /vshop/shop/{id}Change Shop
VShopsApiupdateShopItemPUT /vshop/shop/{id}/item/{item}Change Shop Item
VillagerShopsApiaddShopItemPOST /vshop/shop/{id}/itemAdd Shop Item
VillagerShopsApiaddShopItem_0POST /vshop/shop/{id}/itemAdd Shop Item
VillagerShopsApicreateShopPOST /vshop/shopCreate Shops
VillagerShopsApicreateShop_0POST /vshop/shopCreate Shops
VillagerShopsApideleteShopDELETE /vshop/shop/{id}Delete a Shop
VillagerShopsApideleteShopItemDELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VillagerShopsApideleteShopItem_0DELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VillagerShopsApideleteShop_0DELETE /vshop/shop/{id}Delete a Shop
VillagerShopsApigetShopGET /vshop/shop/{id}Get a Shop
VillagerShopsApigetShopItemGET /vshop/shop/{id}/item/{item}Get a Shop
VillagerShopsApigetShopItem_0GET /vshop/shop/{id}/item/{item}Get a Shop
VillagerShopsApigetShop_0GET /vshop/shop/{id}Get a Shop
VillagerShopsApilistShopItemsGET /vshop/shop/{id}/itemList Shop Items
VillagerShopsApilistShopItems_0GET /vshop/shop/{id}/itemList Shop Items
VillagerShopsApilistShopsGET /vshop/shopList Shops
VillagerShopsApilistShops_0GET /vshop/shopList Shops
VillagerShopsApiupdateShopPUT /vshop/shop/{id}Change Shop
VillagerShopsApiupdateShopItemPUT /vshop/shop/{id}/item/{item}Change Shop Item
VillagerShopsApiupdateShopItem_0PUT /vshop/shop/{id}/item/{item}Change Shop Item
VillagerShopsApiupdateShop_0PUT /vshop/shop/{id}Change Shop
WebBooksApicreateWebBookPOST /web-books/bookCreate a book
WebBooksApideleteWebBookDELETE /web-books/book/{id}Delete a book
WebBooksApigetWebBookGET /web-books/book/{id}Get a book
WebBooksApigetWebBookContentGET /web-books/book/{id}/htmlBook HTML
WebBooksApigetWebBookContentPostPOST /web-books/book/{id}/htmlBook HTML
WebBooksApilistWebBooksGET /web-books/bookList books
WebBooksApimodifyWebBookPUT /web-books/book/{id}Modify a book
WorldApicreateWorldPOST /worldCreate a world
WorldApideleteWorldDELETE /world/{world}Delete a world
WorldApiexecuteMethodPOST /world/{world}/methodExecute a method
WorldApigetWorldGET /world/{world}Get a world
WorldApilistWorldsGET /worldList worlds
WorldApimodifyWorldPUT /world/{world}Modify a world

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

ApiKeyHeader

  • Type: API key
  • API key parameter name: X-WebAPI-Key
  • Location: HTTP header

ApiKeyQuery

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

inithilian@gmail.com

About

Java client for the Web-API (https://github.com/Valandur/Web-API)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages