Author Topic: CWP 7 WHMCS API error  (Read 817 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CWP 7 WHMCS API error
« on: April 20, 2018, 09:37:44 AM »
Hi everyone,
I've installed fresh version of the CWP 7, added new CWP7 module to WHMCS and while trying to create account from WHMCS in CWP panel getting error. After turning on Debug in WHMCS, I've got such error:
Code: [Select]
<html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ErrorException</div><div><strong>Code:</strong> 2</div><div><strong>Message:</strong> mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given</div><div><strong>File:</strong> /usr/local/cwpsrv/var/services/api/v1/index.php</div><h2>Trace</h2><pre><div>#0 [internal function]: Slim\Slim::handleErrors(2, 'mysqli_fetch_as...', '/usr/local/cwps...', 0, Array)
<div>#1 /usr/local/cwpsrv/var/services/api/v1/index.php(0): mysqli_fetch_assoc(false)
<div>#2 [internal function]: {closure}()
<div>#3 /usr/local/cwpsrv/var/services/api/v1/Slim/Route.php(0): call_user_func_array(Object(Closure), Array)
<div>#4 /usr/local/cwpsrv/var/services/api/v1/Slim/Slim.php(0): Slim\Route->dispatch()
<div>#5 /usr/local/cwpsrv/var/services/api/v1/Slim/Middleware/Flash.php(0): Slim\Slim->call()
<div>#6 /usr/local/cwpsrv/var/services/api/v1/Slim/Middleware/MethodOverride.php(0): Slim\Middleware\Flash->call()
<div>#7 /usr/local/cwpsrv/var/services/api/v1/Slim/Middleware/PrettyExceptions.php(0): Slim\Middleware\MethodOverride->call()
<div>#8 /usr/local/cwpsrv/var/services/api/v1/Slim/Slim.php(0): Slim\Middleware\PrettyExceptions->call()
<div>#9 /usr/local/cwpsrv/var/services/api/v1/index.php(0): Slim\Slim->run()
<div>#10 {main}</pre></body></html>

Offline
*
Re: CWP 7 WHMCS API error
« Reply #1 on: April 23, 2018, 12:53:13 PM »
and what happens if you use any other option (Change password, Suspend, etc)

Offline
*
Re: CWP 7 WHMCS API error
« Reply #2 on: April 25, 2018, 06:25:03 PM »
I'm having my CWP (brand new instance) server call a PHP script, which hits the API, and I have the exact same issue as the OP when trying to create a new account. If I change the action to 'list', instead of 'add', I get
Code: [Select]
{"status":"OK","msj":"no records exist"}, which is correct.

Offline
*
Re: CWP 7 WHMCS API error
« Reply #3 on: April 26, 2018, 04:16:27 PM »
and what happens if you use any other option (Change password, Suspend, etc)

When I execute an API call to change a password, it works just fine:
Code: [Select]
{"status":"OK"}I tested it, and the new password must be used, in order to log in with the user.
It looks like there's an issue with the Add Account web service.

Offline
*
Re: CWP 7 WHMCS API error
« Reply #4 on: April 26, 2018, 04:20:40 PM »
The action to add a new user account partially completes, because if you run a second identical request, you receive this the second time:
Code: [Select]
{"status":"Error","msj":"already exists in \/etc\/passwd!"}

Offline
*
Re: CWP 7 WHMCS API error
« Reply #5 on: April 26, 2018, 05:21:36 PM »
I figured out why I was receiving this error. I was sending "default" as the value for the package key. When I changed it to "1", the request worked. I believe the correct value for this field should correspond to HTML value of the Option element in the drop-down, not the text of the element.

Hopefully this helps someone else.
« Last Edit: April 26, 2018, 05:23:58 PM by kendaop »