Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use User API?
I am curious how to use the User API.

The first question is what is the URL of the User API. Is it /api/user.php ?

I try to test the functionality with GET and POST request, but the response is the same: 

{"section":"INV","request":"INV","response":"ERROR","message":"Invalid user api query!"}

The GET request is: 


which I refer to the documentation at:

The POST request is similar, which I call it via PHP:

header('Content-Type: text/plain');

$data = array(
"section" => "test",
"request" => "connection"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Possible attack hole: Man In The Middle
$response = curl_exec($ch);


Identical response via POST. So what did I miss?
The request data should be sent via POST and being in json format, so the header should be set accordingly (not necessary, but to be correct) and the data needs to be encoded with json_encode() before sending.
The automatic CI tests done on the API should help you if in doubt:
It works. Thanks for the tip!

Forum Jump:

Users browsing this thread: 1 Guest(s)