Author Topic: CWP API Manager  (Read 10535 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CWP API Manager
« on: April 25, 2019, 10:16:00 PM »
Hi, I haven't had any success in consuming data and sending payload via the API.

Here's my php test code:

Code: [Select]
<?php
error_reporting
(-1);
ini_set('display_errors''On');

$data = array("key" => "xxxx","action"=>'list');
$url "https://my_host:2304/v1/account";

$ch curl_init();
curl_setopt($chCURLOPT_HEADER1);
curl_setopt($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_CUSTOMREQUEST"POST");
curl_setopt($chCURLOPT_SSL_VERIFYPEER1);
curl_setopt ($chCURLOPT_POSTFIELDShttp_build_query($data));
curl_setopt ($chCURLOPT_POST1);
curl_setopt($chCURLOPT_HTTPGET1);
curl_setopt($chCURLOPT_DNS_USE_GLOBAL_CACHE);
curl_setopt($chCURLOPT_DNS_CACHE_TIMEOUT);
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
$response curl_exec($ch);
var_dump($response);
var_dump(curl_getinfo($ch));
var_dump(curl_error($ch)); 
curl_close($ch);

Here's the php result:
Code: [Select]
vonjour@devel2019:~/Desktop/vonjour.Docker$ php -f test.php
/home/vonjour/Desktop/vonjour.Docker/test.php:24:
string(237) "HTTP/1.1 200 OK
Server: cwpsrv
Date: Thu, 25 Apr 2019 21:53:14 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.0.32

{"status":"Error","msj":"error in key","format":"JSON"}"
/home/vonjour/Desktop/vonjour.Docker/test.php:25:
array(26) {
  'url' =>
  string(38) "https://my_host:2304/v1/account"
  'content_type' =>
  string(16) "application/json"
  'http_code' =>
  int(200)
  'header_size' =>
  int(182)
  'request_size' =>
  int(69)
  'filetime' =>
  int(-1)
  'ssl_verify_result' =>
  int(20)
  'redirect_count' =>
  int(0)
  'total_time' =>
  double(1.40952)
  'namelookup_time' =>
  double(0.257413)
  'connect_time' =>
  double(0.529659)
  'pretransfer_time' =>
  double(1.100879)
  'size_upload' =>
  double(0)
  'size_download' =>
  double(55)
  'speed_download' =>
  double(39)
  'speed_upload' =>
  double(0)
  'download_content_length' =>
  double(-1)
  'upload_content_length' =>
  double(-1)
  'starttransfer_time' =>
  double(1.409498)
  'redirect_time' =>
  double(0)
  'redirect_url' =>
  string(0) ""
  'primary_ip' =>
  string(15) "192.6445.xxx.xxx"
  'certinfo' =>
  array(0) {
  }
  'primary_port' =>
  int(2304)
  'local_ip' =>
  string(11) "192.168.0.9"
  'local_port' =>
  int(45576)
}
/home/vonjour/Desktop/CoreDev.Docker/test.php:26:
string(0) ""

Here's an test I've found from other threads:
Code: [Select]
nborromeo@cent ~$ curl -k "https://xxx.xxx.xxx.xxx:2304/v1/account" -X POST -data "key=IEmzLcOF4Hsozt9bTopbrhQ19nPt6ZuM3BA4pjK49nzVf&action=list"
{"status":"Error","msj":"error in key","format":"JSON"}curl: (6) Could not resolve host: key=IEmzLcOF4Hsozt9bTopbrhQ19nPt6ZuM3BA4pjK49nzVf&action=list; Unknown error

Offline
*
Re: CWP API Manager
« Reply #1 on: April 26, 2019, 05:34:46 AM »
looks like you have dns resolving issues on your server, you need to check /etc/resolv.conf with your server provider or try to use google dns

nameserver 8.8.8.8
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*****
Re: CWP API Manager
« Reply #2 on: April 26, 2019, 07:01:45 AM »
The message is clear

{"status": "Error", "msj": "error in key"

Error in the key, go to the api admin and confirm that yu api key is the same one that you are using, you can also validate that the IP or the answer type are the same as json

Offline
*
Re: CWP API Manager
« Reply #3 on: April 26, 2019, 08:51:39 PM »
The message is clear

{"status": "Error", "msj": "error in key"

Error in the key, go to the api admin and confirm that yu api key is the same one that you are using, you can also validate that the IP or the answer type are the same as json

I'm waiting for you to say this actually. I've got the same API key listing on the API manager, and on the same IP address.

Offline
*
Re: CWP API Manager
« Reply #4 on: April 26, 2019, 08:56:27 PM »
The message is clear

{"status": "Error", "msj": "error in key"

Error in the key, go to the api admin and confirm that yu api key is the same one that you are using, you can also validate that the IP or the answer type are the same as json

I tried about 5 machines got the same error.
It's not a Firewall issue, I added it already.

Offline
*****
Re: CWP API Manager
« Reply #5 on: April 26, 2019, 09:41:32 PM »
I would like to help you solve this problem, I could try placing% instead of the server ip in the apikey

Offline
*
Re: CWP API Manager
« Reply #6 on: April 26, 2019, 09:57:23 PM »
The message is clear

{"status": "Error", "msj": "error in key"

Error in the key, go to the api admin and confirm that yu api key is the same one that you are using, you can also validate that the IP or the answer type are the same as json

I tried about 5 machines got the same error.
It's not a Firewall issue, I added it already.

added the %, *, 0.0.0.0 and a blank IP origin just to try everything. got the same Error in key message.

Offline
*
Re: CWP API Manager
« Reply #7 on: April 26, 2019, 10:00:23 PM »
funny I have this list already

Offline
*
Re: CWP API Manager
« Reply #8 on: April 30, 2019, 02:41:24 PM »
Anyone from the CWP team? is CWP out of business?

Offline
***
Re: CWP API Manager
« Reply #9 on: May 01, 2019, 04:10:37 AM »
Did you already tried this?:
Code: [Select]
curl -k "https://xxx.xxx.xxx.xxx:2304/v1/account" -X POST --data "key=IEmzLcOF4Hsozt9bTopbrhQ19nPt6ZuM3BA4pjK49nzVf" --data "action=list"

(with separated arguments, and '--data', not '-data')

Regards,
Netino

Offline
*
Re: CWP API Manager
« Reply #10 on: May 01, 2019, 03:07:45 PM »
Did you already tried this?:
Code: [Select]
curl -k "https://xxx.xxx.xxx.xxx:2304/v1/account" -X POST --data "key=IEmzLcOF4Hsozt9bTopbrhQ19nPt6ZuM3BA4pjK49nzVf" --data "action=list"

(with separated arguments, and '--data', not '-data')

Hi Netino, good news! it works! I'll test some more on the other endpoints and action types. Thank you! I never thought of separating the POST data would solve it.

Best,

Regards,
Netino

Offline
*
Re: CWP API Manager
« Reply #11 on: May 01, 2019, 03:23:06 PM »
Hi Netino, just want to let you know that it worked pretty well on other endpoints and different actions too! thank you!

Best

Offline
*****
Re: CWP API Manager
« Reply #12 on: June 11, 2019, 11:48:29 PM »
Hello

Apparently you have a problem with the api key!