Search code examples
node.jsapiadminpanel

The requested default allocation is not currently assigned to this server. Pterodactyl panel



I have my own API and want to fix server edit also update the build configuration, but as I want to test it it says sth like allocation field needed, then I did go to https://dashflo.net/docs/api/pterodactyl/v1/#req_11fc764c3ed648ca8e6d60bff860ca6d to read further and in their example they used "allocation: 1", also I did that and then it says "The requested default allocation is not currently assigned to this server.", "status: 400", "code: 'DisplayException'" and I don't know how to fix it I tryied allocation: "2" or "0" but then it says invalid...

This is my Request:

{
"id": id,
"allocation": "1",
'memory': RAM,
'swap': "0",
'disk': Disk,
'io': IO,
'cpu': CPU,
"threads": null,
'feature_limits': {
    'databases': AmountOfDatabases,
    'allocations': AmountOfAllocations,
    "backups": Backups
},
}

I am using axios to send the PATCH request.


Solution

  • I know the error I need to change my create server request from

    {
            'name': NameOfServer,
            'user': OwnerID,
            'description': 'A Nodeactyl server',
            'egg': EggID,
            'pack': NestID,
            'docker_image': DockerImage,
            'startup': StartupCmd,
            'limits': {
                'memory': RAM,
                'swap': Swap,
                'disk': Disk,
                'io': IO,
                'cpu': CPU,
            },
            'feature_limits': {
                'databases': AmountOfDatabases,
                'allocations': AmountOfAllocations,
                'backups': backups
            },
            'environment': {
                'DL_VERSION': Version,
                'SERVER_JARFILE': 'server.jar',
                'VANILLA_VERSION': Version,
                'BUNGEE_VERSION': Version,
                'PAPER_VERSION': Version,
                'MC_VERSION': Version,
                'BUILD_NUMBER': Version,
                'INSTALL_REPO': Version,
                "BOT_JS_FILE": "index.js",
                "AUTO_UPDATE": true,
                "USER_UPLOAD": true
            },
            'allocation': {
                'default': 1,
                'additional': [],
            },
            'deploy': {
                'locations': [1],
                'dedicated_ip': false,
                'port_range': [],
            },
            'start_on_completion': true,
            'skip_scripts': false,
            'oom_disabled': true
    }
    

    to:

    {
            'name': NameOfServer,
            'user': OwnerID,
            'description': 'A Nodeactyl-v1-support server',
            'egg': EggID,
            'pack': NestID,
            'docker_image': DockerImage,
            'startup': StartupCmd,
            'limits': {
                'memory': RAM,
                'swap': Swap,
                'disk': Disk,
                'io': IO,
                'cpu': CPU,
            },
            'feature_limits': {
                'databases': AmountOfDatabases,
                'allocations': AmountOfAllocations,
                'backups': backups
            },
            'environment': {
                'DL_VERSION': Version,
                'SERVER_JARFILE': 'server.jar',
                'VANILLA_VERSION': Version,
                'BUNGEE_VERSION': Version,
                'PAPER_VERSION': Version,
                'MC_VERSION': Version,
                'BUILD_NUMBER': Version,
                'INSTALL_REPO': Version,
                "BOT_JS_FILE": "index.js",
                "AUTO_UPDATE": true,
                "USER_UPLOAD": true
            },
            "allocation": {
                "default": 1
            },
            'start_on_completion': true,
            'skip_scripts': false,
            'oom_disabled': true
    }