Skip to content

Repository files navigation

Web-API - Python 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

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 5.4.2-S7.1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen For more information, please visit https://github.com/Valandur

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

importswagger_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

importswagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ importprint_functionimporttimeimportswagger_clientfromswagger_client.restimportApiExceptionfrompprintimportpprint# Configure API key authorization: ApiKeyHeaderconfiguration=swagger_client.Configuration()
configuration.api_key['X-WebAPI-Key'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-WebAPI-Key'] = 'Bearer'# Configure API key authorization: ApiKeyQueryconfiguration=swagger_client.Configuration()
configuration.api_key['key'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['key'] = 'Bearer'# create an instance of the API classapi_instance=swagger_client.ActiveTimeApi(swagger_client.ApiClient(configuration))
details=true# bool | Add to include additional details, omit or false otherwise (optional)accept='accept_example'# str | Override the 'Accept' request header (useful for debugging your requests) (optional)pretty=true# bool | Add to make the Web-API pretty print the response (useful for debugging your requests) (optional)try:
# Server reportapi_response=api_instance.get_server_report(details=details, accept=accept, pretty=pretty)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling ActiveTimeApi->get_server_report: %s\n"%e)

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
ActiveTimeApiget_server_reportGET /active-timeServer report
ActiveTimeApiget_user_reportGET /active-time/user/{uuid}User report
BlockApicreate_block_operationPOST /block/opCreate a block operation
BlockApidelete_block_operationDELETE /block/op/{uuid}Stop a block operation
BlockApiget_blockGET /block/{world}/{x}/{y}/{z}Get a block
BlockApiget_block_operationGET /block/op/{uuid}Get a block operation
BlockApilist_block_operationsGET /block/opList block operations
BlockApimodify_block_operationPUT /block/op/{uuid}Modify a block operation
ChunkApicreate_chunk_atPOST /chunk/{world}/{x}/{z}Load & Generate a chunk
ChunkApiget_chunk_atGET /chunk/{world}/{x}/{z}Get a chunk
ChunkApilist_chunksGET /chunk/{world}List chunks
CmdSchedulerApidelete_taskDELETE /cmd-scheduler/{name}Delete a task
CmdSchedulerApilist_tasksGET /cmd-schedulerList tasks
CommandApiget_commandGET /cmd/{cmd}Get a command
CommandApilist_commandsGET /cmdList commands
CommandApirun_commandsPOST /cmdExecute a command
EconomyApiget_accountGET /economy/account/{id}List currencies
EconomyApiget_currenciesGET /economy/currencyList currencies
EntityApicreate_entityPOST /entitySpawn an entity
EntityApiexecute_methodPOST /entity/{entity}/methodExecute a method
EntityApiget_entityGET /entity/{entity}Get entity
EntityApilist_entitiesGET /entityList entities
EntityApimodify_entityPUT /entity/{entity}Modify an entity
EntityApiremove_entityDELETE /entity/{entity}Destroy an entity
HistoryApiget_chatGET /history/messageGet message history
HistoryApiget_commandsGET /history/cmdGet command history
InfoApiget_infoGET /infoServer info
InfoApiget_statsGET /info/statsServer stats
InfoApilist_servletsGET /info/servletsList servlets
InteractiveMessageApiget_messageGET /interactive-message/{uuid}Get a message
InteractiveMessageApilist_messagesGET /interactive-messageList messages
InteractiveMessageApisend_messagePOST /interactive-messageSend a message
InventoryApiadd_elementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
InventoryApiclose_rendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
InventoryApicreate_menuPOST /megamenus/menuCreate menu
InventoryApicreate_rendererPOST /megamenus/render/{mid}Create menu
InventoryApidelete_elementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
InventoryApidelete_menuDELETE /megamenus/menu/{mid}Delete menu
InventoryApidelete_pageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
InventoryApidelete_rendererDELETE /megamenus/renderer/{mid}Delete menu
InventoryApifind_rendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
InventoryApiget_elementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
InventoryApiget_menuGET /megamenus/menu/{mid}Get menu
InventoryApiget_pageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
InventoryApiget_rendererGET /megamenus/render/{mid}Get the renderer for this menu
InventoryApilist_menusGET /megamenus/menuList menus
InventoryApilist_rendererGET /megamenus/renderList renderer
InventoryApiopen_rendererPUT /megamenus/render/{mid}/{viewer}Open renderer
InventoryApiset_elementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
InventoryApiset_menuPUT /megamenus/menu/{mid}Update menu
MapApiget_mapGET /map/{world}/{x}/{z}Get a map tile
MegaMenusApiadd_elementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
MegaMenusApiclose_rendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
MegaMenusApicreate_menuPOST /megamenus/menuCreate menu
MegaMenusApicreate_rendererPOST /megamenus/render/{mid}Create menu
MegaMenusApidelete_elementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
MegaMenusApidelete_menuDELETE /megamenus/menu/{mid}Delete menu
MegaMenusApidelete_pageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
MegaMenusApidelete_rendererDELETE /megamenus/renderer/{mid}Delete menu
MegaMenusApifind_rendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
MegaMenusApiget_elementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
MegaMenusApiget_menuGET /megamenus/menu/{mid}Get menu
MegaMenusApiget_pageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
MegaMenusApiget_rendererGET /megamenus/render/{mid}Get the renderer for this menu
MegaMenusApilist_menusGET /megamenus/menuList menus
MegaMenusApilist_rendererGET /megamenus/renderList renderer
MegaMenusApiopen_rendererPUT /megamenus/render/{mid}/{viewer}Open renderer
MegaMenusApiset_elementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
MegaMenusApiset_menuPUT /megamenus/menu/{mid}Update menu
MenuApiadd_elementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
MenuApiclose_rendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
MenuApicreate_menuPOST /megamenus/menuCreate menu
MenuApicreate_rendererPOST /megamenus/render/{mid}Create menu
MenuApidelete_elementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
MenuApidelete_menuDELETE /megamenus/menu/{mid}Delete menu
MenuApidelete_pageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
MenuApidelete_rendererDELETE /megamenus/renderer/{mid}Delete menu
MenuApifind_rendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
MenuApiget_elementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
MenuApiget_menuGET /megamenus/menu/{mid}Get menu
MenuApiget_pageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
MenuApiget_rendererGET /megamenus/render/{mid}Get the renderer for this menu
MenuApilist_menusGET /megamenus/menuList menus
MenuApilist_rendererGET /megamenus/renderList renderer
MenuApiopen_rendererPUT /megamenus/render/{mid}/{viewer}Open renderer
MenuApiset_elementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
MenuApiset_menuPUT /megamenus/menu/{mid}Update menu
PermissionApiget_collectionGET /permission/collection/{id}Get collection
PermissionApiget_subjectGET /permission/collection/{id}/subject/{subId}Get subject
PermissionApilist_collectionsGET /permission/collectionList collections
PermissionApilist_subjectsGET /permission/collection/{id}/subjectList subjects
PlayerApiexecute_methodPOST /player/{player}/methodExecute a method
PlayerApiget_playerGET /player/{player}Get a player
PlayerApilist_playersGET /playerList players
PlayerApimodify_playerPUT /player/{player}Modify a player
PluginApichange_plugin_configPOST /plugin/{plugin}/configChange plugin configs
PluginApiget_pluginGET /plugin/{plugin}Get a plugin
PluginApiget_plugin_configGET /plugin/{plugin}/configGet plugin configs
PluginApilist_pluginsGET /pluginList plugins
PluginApitoggle_pluginPUT /plugin/{plugin}Toggle a plugin
RecipeApilist_recipesGET /recipeList recipes
RedProtectApicreate_regionPOST /red-protect/regionCreate a region
RedProtectApidelete_regionDELETE /red-protect/region/{id}Delete a region
RedProtectApiget_regionGET /red-protect/region/{id}Get a region
RedProtectApilist_regionsGET /red-protect/regionList regions
RedProtectApimodify_regionPUT /red-protect/region/{id}Modify a region
RegistryApiget_registryGET /registry/{class}Get a catalog type
ServerApilist_propertiesGET /server/propertiesList server properties
ServerApimodify_propertiesPUT /server/propertiesModify server properties
TileEntityApiexecute_methodPOST /tile-entity/{world}/{x}/{y}/{z}/methodExecute a method
TileEntityApiget_tile_entityGET /tile-entity/{world}/{x}/{y}/{z}Get tile entity
TileEntityApilist_tile_entitiesGET /tile-entityList tile entities
TileEntityApimodify_tile_entityPUT /tile-entity/{world}/{x}/{y}/{z}Modify tile entity
UIApiadd_elementPOST /megamenus/menu/{mid}/{page}/{y}/{x}Add element
UIApiclose_rendererDELETE /megamenus/render/{mid}/{viewer}Close renderer
UIApicreate_menuPOST /megamenus/menuCreate menu
UIApicreate_rendererPOST /megamenus/render/{mid}Create menu
UIApidelete_elementDELETE /megamenus/menu/{mid}/{page}/{y}/{x}Delete menu
UIApidelete_menuDELETE /megamenus/menu/{mid}Delete menu
UIApidelete_pageDELETE /megamenus/menu/{mid}/{page}Delete a page of elements
UIApidelete_rendererDELETE /megamenus/renderer/{mid}Delete menu
UIApifind_rendererGET /megamenus/render/find/{viewer}Get the renderer for viewer
UIApiget_elementGET /megamenus/menu/{mid}/{page}/{y}/{x}Get menu
UIApiget_menuGET /megamenus/menu/{mid}Get menu
UIApiget_pageGET /megamenus/menu/{mid}/{page}Reads a single page of elements
UIApiget_rendererGET /megamenus/render/{mid}Get the renderer for this menu
UIApilist_menusGET /megamenus/menuList menus
UIApilist_rendererGET /megamenus/renderList renderer
UIApiopen_rendererPUT /megamenus/render/{mid}/{viewer}Open renderer
UIApiset_elementPUT /megamenus/menu/{mid}/{page}/{y}/{x}Update menu
UIApiset_menuPUT /megamenus/menu/{mid}Update menu
UniversalMarketApilist_market_itemsGET /universal-market/itemList items
UserApicreate_userPOST /userCreate a user
UserApidelete_userDELETE /user/{name}Delete a user
UserApiget_meGET /user/meCheck info
UserApiget_usersGET /userList users
UserApiloginPOST /user/loginLogin
UserApilogoutPOST /user/logoutLogout
UserApilogout_redirectGET /user/logout
UserApimodify_userPUT /user/{name}Update a user
VShopsApiadd_shop_itemPOST /vshop/shop/{id}/itemAdd Shop Item
VShopsApicreate_shopPOST /vshop/shopCreate Shops
VShopsApidelete_shopDELETE /vshop/shop/{id}Delete a Shop
VShopsApidelete_shop_itemDELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VShopsApiget_shopGET /vshop/shop/{id}Get a Shop
VShopsApiget_shop_itemGET /vshop/shop/{id}/item/{item}Get a Shop
VShopsApilist_shop_itemsGET /vshop/shop/{id}/itemList Shop Items
VShopsApilist_shopsGET /vshop/shopList Shops
VShopsApiupdate_shopPUT /vshop/shop/{id}Change Shop
VShopsApiupdate_shop_itemPUT /vshop/shop/{id}/item/{item}Change Shop Item
VillagerShopsApiadd_shop_itemPOST /vshop/shop/{id}/itemAdd Shop Item
VillagerShopsApicreate_shopPOST /vshop/shopCreate Shops
VillagerShopsApidelete_shopDELETE /vshop/shop/{id}Delete a Shop
VillagerShopsApidelete_shop_itemDELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VillagerShopsApiget_shopGET /vshop/shop/{id}Get a Shop
VillagerShopsApiget_shop_itemGET /vshop/shop/{id}/item/{item}Get a Shop
VillagerShopsApilist_shop_itemsGET /vshop/shop/{id}/itemList Shop Items
VillagerShopsApilist_shopsGET /vshop/shopList Shops
VillagerShopsApiupdate_shopPUT /vshop/shop/{id}Change Shop
VillagerShopsApiupdate_shop_itemPUT /vshop/shop/{id}/item/{item}Change Shop Item
VillagerShopsApiadd_shop_itemPOST /vshop/shop/{id}/itemAdd Shop Item
VillagerShopsApicreate_shopPOST /vshop/shopCreate Shops
VillagerShopsApidelete_shopDELETE /vshop/shop/{id}Delete a Shop
VillagerShopsApidelete_shop_itemDELETE /vshop/shop/{id}/item/{item}Removes a Shop Item
VillagerShopsApiget_shopGET /vshop/shop/{id}Get a Shop
VillagerShopsApiget_shop_itemGET /vshop/shop/{id}/item/{item}Get a Shop
VillagerShopsApilist_shop_itemsGET /vshop/shop/{id}/itemList Shop Items
VillagerShopsApilist_shopsGET /vshop/shopList Shops
VillagerShopsApiupdate_shopPUT /vshop/shop/{id}Change Shop
VillagerShopsApiupdate_shop_itemPUT /vshop/shop/{id}/item/{item}Change Shop Item
WebBooksApicreate_web_bookPOST /web-books/bookCreate a book
WebBooksApidelete_web_bookDELETE /web-books/book/{id}Delete a book
WebBooksApiget_web_bookGET /web-books/book/{id}Get a book
WebBooksApiget_web_book_contentGET /web-books/book/{id}/htmlBook HTML
WebBooksApiget_web_book_content_postPOST /web-books/book/{id}/htmlBook HTML
WebBooksApilist_web_booksGET /web-books/bookList books
WebBooksApimodify_web_bookPUT /web-books/book/{id}Modify a book
WorldApicreate_worldPOST /worldCreate a world
WorldApidelete_worldDELETE /world/{world}Delete a world
WorldApiexecute_methodPOST /world/{world}/methodExecute a method
WorldApiget_worldGET /world/{world}Get a world
WorldApilist_worldsGET /worldList worlds
WorldApimodify_worldPUT /world/{world}Modify a world

Documentation For Models

Documentation For Authorization

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

Author

inithilian@gmail.com

About

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

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages