Ptero4J icon indicating copy to clipboard operation
Ptero4J copied to clipboard

Error 422 When creating server from BungeeCord

Open Acixsi opened this issue 5 years ago • 3 comments

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!

Acixsi avatar Apr 27 '20 02:04 Acixsi

i have the same problem

Skogrine avatar Apr 15 '21 08:04 Skogrine

same problem...

MoMMde avatar May 14 '21 16:05 MoMMde

I offer you this dependency, which to my taste, is much more complete and easy to use

Pterodactyl4J

Have a good day :)

Skogrine avatar Jun 13 '21 02:06 Skogrine