-
Notifications
You must be signed in to change notification settings - Fork 16
Editor API
The editor system follows a simple flow. Firstly, the developer will post some input and the server will respond with a token. This token can be given to the user to allow them to edit the input string. When the user clicks the save button, they will be given a command which provides the developer with a new token that they can use to request the resulting MiniMessage string.
There are multiple ways to use this API but some examples are provided below.
See this gist for an example Java API that you can include in your project.
All requests should be prefixed with the URL of the adventure-webui instance that you are making the request to.
Make a POST request to example.com/api/editor/input
with the following JSON payload:
{
"input": "<red>This is my input!",
"command": "/myplugin save motd {token}",
"application": "MyPlugin"
}
Key | Description |
---|---|
input |
The MiniMessage string that will be inserted into the input. |
command |
The command that the user will run to save the input. In this string, the substring {token} will be replaced with the token. |
application |
The name of your application which will be displayed to the user. |
If your input was valid, you will be provided with the following response:
{"token": "XYZ"}
This response is the token that the user can use to access the saved input.
To reach this, the user should navigate to example.com?token=XYZ
.
When the user hits the save button and runs the command you provided earlier, you will have access to a new token.
To obtain the MiniMessage output, you should make a GET request to example.com/api/editor/output?token=XYZ
.
If the token is valid, the response will be a plain text string of the resulting MiniMessage that you can use to your heart's desire.
For support with adventure-webui, visit the Kyori Discord.