Hestia API returns 10 though settings are correct

Hi,

I have previous had the hestia api working using the below request.

But now the api returns ‘10’.

I have create the access and secrets keys both with the web interface and with v-add-access-key ‘admin’ ‘*’. Both of them returned 10 from the api.

$hst_returncode = 'yes';
$hst_command = 'v-add-user';
$hash = 'access_key:secret';

// Prepare POST query
$postvars = array(
'hash' => $hash,
'returncode' => $hst_returncode,
'cmd' => $hst_command,
'arg1' => $username,
'arg2' => $password,
'arg3' => $email,
'arg4' => $package,
'arg5' => $first_name,
'arg6' => $last_name
      );

// Send POST query via cURL
$postdata = http_build_query($postvars);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://panel.apexit.uk:8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);

Hi,

You must allow the IP you are connecting from using the variable API_ALLOWED_IP

Example to add 127.0.0.1:

v-add-sys-api-ip 127.0.0.1

Thank you!

Crazy how this isn’t default

1 Like

Why add 127.0.0.1 by default when you can just use the commands directly?

I think what my friend is trying to say is that the API should accept requests sent by the same server as the panel is hosted on.