hcgcloud / pterodactyl-sdk

Pterodactyl Panel PHP SDK/API wrapper
https://hcgcloud.github.io/pterodactyl-sdk-docs/
MIT License
27 stars 25 forks source link

Trying to create an user, gives an error. #6

Closed ROCHatty closed 4 years ago

ROCHatty commented 4 years ago

Hi,, So I am trying to create a new user. This is the code that I'm using: $pterodactyl = new \HCGCloud\Pterodactyl\Pterodactyl("KEY_REMOVED", "URL_REMOVED"); $password = randomPassword(); $user = $pterodactyl->createUser([ "external_id" => $id, "email" => $id.'@hattorius.com', "username" => $id, "first_name" => $id, "last_name" => $id, "language" => 'en', "password" => $password ]);

I get the following error ->

Fatal error: Uncaught HCGCloud\Pterodactyl\Exceptions\ValidationException: The given data failed to pass validation. in /home/admin/domains/URL_REMOVED/public_html/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php:110 Stack trace: #0 /home/admin/domains/URL_REMOVED/public_html/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php(95): HCGCloud\Pterodactyl\Pterodactyl->handleRequestError(Object(GuzzleHttp\Psr7\Response)) #1 /home/admin/domains/URL_REMOVED/public_html/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php(33): HCGCloud\Pterodactyl\Pterodactyl->request('POST', 'api/application...', Array) #2 /home/admin/domains/URL_REMOVED/public_html/vendor/hcgcloud/pterodactyl-sdk/src/Actions/ManagesUsers.php(52): HCGCloud\Pterodactyl\Pterodactyl->post('api/application...', Array) #3 /home/admin/domains/URL_REMOVED/public_html/DO_NOT_TOUCH/index.php(156): HCGCloud\Pterodactyl\Pterodactyl->createUser(Array) #4 /home/admin/domains/URL_REMOVED/public_html/DO_NOT_TOUCH/index.php(181): buyservice('610603160301469 in /home/admin/domains/URL_REMOVED/public_html/vendor/hcgcloud/pterodactyl-sdk/src/MakesHttpRequests.php on line 110

I've installed the SDK with composer. It went very smooth and no errors/warnings were created. Also, executing createUser() gives the error, making the connection doesn't.

I would very much appreciate the help! <3

tyson239 commented 4 years ago

This problem is cause by the panel's API, you should check the parameters passed to the function.