Rest API
Here you can view the endpoints and how to access/use the Player Businesses Rest API.
The Player Businesses REST API extends the capabilities of the Player Businesses 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 Businesses REST API is determined by the server administrator. Please remember to include the base URL of the server where the Player Businesses API is hosted, which can probably be found on the servers documentation.
Authentication
To interact with the Player Businesses 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:
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
/pb 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:
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:
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 Businesses plugin. Each endpoint includes detailed descriptions, request methods, parameters, and responses.
To view the available endpoints, go to the Endpoints page.
Events
The Player Businesses API also supports real-time event handling through WebSockets. This section covers connecting, subscribing, and receiving events like business creation or deletion.
Go to the Events page for details on subscribing to and receiving WebSocket events.
Errors
The Player Businesses API can throw errors, and you will need to catch them! You can view them here.
Last updated
Was this helpful?