Ptero4J
Ptero4J copied to clipboard
Error 422 When creating server from BungeeCord
Hi there,
I'm trying to make a system where I can deploy new servers from inside our Bungeecord proxy using this API. But now comes the point where I'm getting errors... I'm getting this:
>.... [02:27:49 INFO]: An error occurred while making a request to the panel, if the issue persists please create an issue on github.
>.... [02:27:49 INFO]: 422 POST https://panel.snl.bruijns.tech/api/application/servers
And this is my code:
public class ServerHandler extends Command {
public ServerHandler(ServerDeployer serverDeployer) {
super("deploypf");
}
public static void deployNew() {
PteroAdminAPI api = new PteroAdminAPI("https://panel.snl.bruijns.tech/", "I HAVE MY KEY HERE USUALLY, BUT REMOVED IT FOR NOW.");
ServerCreateAction server = api.getServersController().createNew();
server.setName("pf01").setDescription("TEST FOR PF01").setUserId(2).setAllocation(1).setPortRange(String.valueOf(25657)).setLimits(1024, -1, 0, 500, 0).setEggId(17).setPackId(1).setDockerImage("quay.io/pterodactyl/core:java").setStartOnCompletion(true).execute();
}
@Override
public void execute(CommandSender sender, String[] args) {
if(sender instanceof ProxiedPlayer) {
ProxiedPlayer p = (ProxiedPlayer) sender;
deployNew();
}
}
}
Is there any possibility you can help me solving my issue?
I hope to hear from you!
i have the same problem
same problem...
I offer you this dependency, which to my taste, is much more complete and easy to use
Have a good day :)