Rest API

Here you can view the endpoints and how to access/use the Player Auctions Rest API.

The Player Auctions REST API extends the capabilities of the Player Auctions 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 Auctions REST API is determined by the server administrator. Please remember to include the base URL of the server where the Player Auctions API is hosted, which can probably be found on the servers documentation.

Authentication

To interact with the Player Auctions 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 here).

  • Password: Your API Key (a unique token generated for your account to interact with the API).

Generating an API Key

To generate an API token, use the command:

/pa apitokens generate

This will create a new API token for your account, which can then be used for authentication in your API requests. Do not share your API token with anyone else, as it provides access to your account and data.

API Key Limitations

  • You can only have one active API token at a time.

  • If you generate a new API token using /pa apitokens generate, it will replace your existing API token. The previous token will no longer be valid.

  • If you wish to delete your API token without generating a new one, use the following command:

    /pa apitokens delete

    This will delete your existing API token, but will not generate a new one. You will need to generate a new token manually if required.

Example API Request

Here’s how to authenticate API requests using your Minecraft UUID and API token:

Request Header:

Authorization: Basic {Base64 encoded string of 'UUID:API_KEY'}

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.

Endpoints

You will find a comprehensive list of all the available API endpoints for interacting with the Player Auctions plugin. Each endpoint includes detailed descriptions, request methods, parameters, and responses.

To view the available endpoints, go to the Endpoints page.

Events

The Player Auctions API also supports real-time event handling through WebSockets. This section covers connecting, subscribing, and receiving events like auction creation or removal.

Go to the Events page for details on subscribing to and receiving WebSocket events.

Errors

The Player Auctions API can throw errors, and you will need to catch them! You can view them here.

Last updated

Was this helpful?