Hi, I haven't had any success in consuming data and sending payload via the API.
Here's my php test code:
<?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($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 1 );
curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 2 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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:
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:
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