Author Topic: API Domain  (Read 11607 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
API Domain
« on: September 10, 2018, 07:20:45 PM »
Hallo,
ich bin leider jetzt erst dazu gekommen die Domain Funktion bei der Api zu testen.
leider muss ich feststellen, das der Server keine Antwort auf die Anfrage per Curl gibt.
Liegt das an meinem Code oder ist hier eventuell noch ein kleiner fehler im Script?

this is my code:

Code: [Select]
$data = array(
"key" => $key,
"action" => 'list',
"user" => 'isaack',
"type" => 'subdomain',
"name" => $domain,
"path" => 'public_html/vms-suee/'
);

$url = "https://91.194.84.77:2304/v1/admindomains";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
return $response;

Offline
*****
Re: API Domain
« Reply #1 on: September 11, 2018, 09:07:29 AM »
What error throws you? try placing% instead of the ip in the apikey

Offline
*
Re: API Domain
« Reply #2 on: September 11, 2018, 05:39:56 PM »
Unfortunately, I only get a white page. have looked with the firebug what happens, but unfortunately I get there only 500 errors and nothing more.
in the log file in /var/log/cwp/cwp_api.log is unfortunately only the following:
Code: [Select]
2018-09-11 17:39:11  grep <D9XdaLOAVitcvNzMN0dTySSpsESRwgE3lqqVrsHKLNPuw> /root/.conf/apikey
2018-09-11 17:39:11  authorized
the change to% has unfortunately brought no change.

Offline
*****
Re: API Domain
« Reply #3 on: September 11, 2018, 08:45:05 PM »
Check the permissions you have given to the api key, when you are not allowed to list domains

Offline
*
Re: API Domain
« Reply #4 on: September 12, 2018, 11:26:37 AM »
Sorry, this was my mistake. it should not be list but add there stand. so I have it in my code in it. with list everything goes without problems. There I also get the json code displayed.
the problem is with add.

Offline
*****
Re: API Domain
« Reply #5 on: September 12, 2018, 11:31:53 AM »
Please confirm that in the Apis administrator, you have permission to add or list domains or subdomains

Offline
*
Re: API Domain
« Reply #6 on: September 12, 2018, 05:06:23 PM »
hello, yes, all permissions are set. list, add and del

Offline
*
Re: API Domain
« Reply #7 on: September 14, 2018, 08:13:27 PM »
is there no reaction?
pity, I still have no idea why this does not work with the domain.

Offline
*
Re: API Domain
« Reply #8 on: September 18, 2018, 12:37:36 PM »
hello, I am now so far that it works.
it was because of my script that it really was not. please excuse this.

However, I have now found a mistake that does not come from me.

here is my code:
Code: [Select]
class Einrichten{
public function mysql_db($db_name){
$data = array(
"key" => KEY_MYSQL_DB,
"action"=>'add',
"user" => USER,
"database" => $db_name
);
$this->aufruf_api($data,"databasemysql");
}

public function mysql_user($userdb,$dbase){
$pass = create_code(10);
$data = array(
"key" => KEY_MYSQL_USER,
"action"=>'add',
"user" => USER,
"userdb" => $userdb,
"dbase" => $db_name,
"pass" => $pass,
"host" => 'Localhost'
);
$this->aufruf_api($data,"usermysql");
}

public function domain_add($domain){
$data = array(
"key" => KEY_DOMAIN_ADD,
"action" => 'add',
"user" => USER ,
"type" => 'domain',
"name" => $domain,
"path" => 'vms_suee/'
);
$this->aufruf_api($data,"admindomains");
}

protected function aufruf_api($data,$url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, DOMAIN .$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
echo curl_errno($ch);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response);
$this->response = $response;
}
}
and the following is the return from the server:

Code: [Select]
stdClass Object
(
    [status] => OK
    [msj] => Domain testweise.vms1-scripte.de was removed
)

permissions etc are all law

Offline
*
Re: API Domain
« Reply #9 on: September 22, 2018, 10:53:41 AM »
Do not you get any answers here?
Do you really let the user just sit there on the problems?  >:( >:(

I would solve the problems myself. but that is unfortunately not possible by the encryption

Offline
*
Re: API Domain
« Reply #10 on: October 02, 2018, 07:23:31 PM »
Any way you could figure out solution bro?

Today I tried the same thing and having the same issue...  :-[

Offline
*
Re: API Domain
« Reply #11 on: October 03, 2018, 11:36:02 AM »
no, since you can not see the source code yourself and therefore can not do anything, i just waited myself. nothing happened and you unfortunately get no answers here.
I now have another panel and have canceled the CWP.
you have to pay here apparently really, so that something happens and because I think mitlerweile that there is just as bad support as here in the forum, I switched to another panel, where everything works properly.