Closed tommyvange closed 4 years ago
Hello, when I try to connect to my server with this library it throws a 403 error:
Fatal error: Uncaught Exception: { "errors": [ { "code": "AccessDeniedHttpException", "status": "403", "detail": "An error was encountered while processing this request." } ] } in /home/absolutg/public_html/query/pterodactyl/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php:121 Stack trace: #0 /home/absolutg/public_html/query/pterodactyl/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php(95): HCGCloud\Pterodactyl\Pterodactyl->handleRequestError(Object(GuzzleHttp\Psr7\Response)) #1 /home/absolutg/public_html/query/pterodactyl/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php(21): HCGCloud\Pterodactyl\Pterodactyl->request('GET', 'api/application...') #2 /home/absolutg/public_html/query/pterodactyl/vendor/hcgcloud/pterodactyl-sdk/src/Actions/ManagesServers.php(32): HCGCloud\Pterodactyl\Pterodactyl->get('api/application...') #3 /home/absolutg/public_html/query/pterodactyl/index.php(6): HCGCloud\Pterodactyl\Pterodactyl->server('ddca964e') #4 {ma in /home/absolutg/public_html/query/pterodactyl/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php on line 121
My Code:
<?php require_once("vendor/autoload.php"); $pterodactyl = new \HCGCloud\Pterodactyl\Pterodactyl('API_KEY_HIDDEN', 'URL_HIDDEN'); $server = $pterodactyl->server('SERVER_ID_HIDDEN'); $egg = $pterodactyl->egg($nest_id, $egg_id); $server = $pterodactyl->createServer([ "external_id" => $external_id, "name" => $name, "user" => $user_id, "egg" => $egg_id, "pack" => 0, "docker_image" => $egg->dockerImage, "skip_scripts" => false, "environment" => [], "limits" => [ "memory" => $memory, "swap" => $swap, "disk" => $disk, "io" => $io, "cpu" => $cpu ], "feature_limits" => [ "databases" => $databases, "allocations" => $allocations ], "startup" => $egg->startup, "description" => "", "deploy" => [ "locations" => [$location_id], "dedicated_ip" => false, "port_range" => [] ], "start_on_completion" => true ]); echo $server; ?>
I have been unable to find out how to resolve it, please help me.
Thanks, Tommy Vange
Hello, please check your api key, it should be an Application API generated from http://your.panel/admin/api.
Application API
http://your.panel/admin/api
I was making a user API key. Thank you!
Hello, when I try to connect to my server with this library it throws a 403 error:
My Code:
I have been unable to find out how to resolve it, please help me.
Thanks, Tommy Vange