Last updated
Last updated
The Player Elections REST API extends the capabilities of the Player Elections plugin, allowing interaction with plugin objects and events from outside the Minecraft server environment. This documentation provides a comprehensive guide to using the API, including its endpoints, WebSocket functionality, and authentication mechanisms.
The base URL for the Player Elections REST API is determined by the server administrator. Please remember to include the base URL of the server where the Player Elections API is hosted, which can probably be found on the servers documentation.
To interact with the Player Elections REST API or WebSocket, authentication is required to ensure secure access. We use Basic Authentication, where:
Username: Your Minecraft UUID (You can find your FULL UUID ).
Password: Your API Key (a unique key generated for your account to interact with the API).
To generate an API key, use the command:
This will create a new API key for your account, which can then be used for authentication in your API requests.
You can only have one active API key at a time.
If you generate a new API key using /elections apikeys generate
, it will replace your existing API key. The previous key will no longer be valid.
If you wish to delete your API key without generating a new one, use the following command:
This will delete your existing API key, but will not generate a new one. You will need to generate a new key manually if required.
Here’s how to authenticate API requests using your Minecraft UUID and API key:
Request Header:
In this case, the base64 encoded string would be a combination of your Minecraft UUID and API Key (separated by a colon). You can use your program to easily generate the base64 encoding.
You will find a comprehensive list of all the available API endpoints for interacting with the Player Elections plugin. Each endpoint includes detailed descriptions, request methods, parameters, and responses.
The Player Elections API also supports real-time event handling through WebSockets. This section covers connecting, subscribing, and receiving events like election creation or deletion.
To view the available endpoints, go to the page.
Go to the page for details on subscribing to and receiving WebSocket events.
The Player Elections API can throw errors, and you will need to catch them! You can view them .
Here you can view the endpoints and how to access/use the Player Elections Rest API.