system
1
Migrated from Redmine #495 | Author: Antonio Cabrera
Status: New | Priority: High, I’m very impatient | Created: 2020-03-16
Hi team!
I’m having troubles capturing the response from the getBooking method.
I am following the steps below:
1.- Login to get token
2.- I create “sign” with: md5($bookingId . $bookingHash . $secretKey)
3.- I send this https request:
method: POST
url: https://user-api.simplybook.me
Header:
X-Company-Login : dietfarma
X-Token : a3885fb0175e797c62b16e8d835a5fab5933427733a2cd9d5d3c706ff321b5de
Content-Type : application/json
Body: {“jsonrpc”:“2.0”, “method”:“getBooking”, “params”:[“55”,“c7d2d2a0c3addba9aa07cb213ae10dfb”]}
I getting 200 OK but the response is empty. Could you help me?
I’ve read the documentation but I don’t understand how to get the response with “object” value.
I attached a screenshot.
Thank you very much in advance!!.
Best regards.
system
2
Redmine Admin wrote:
<?php
include 'JsonRpcClient.php';
define('YOUR_COMPANY_LOGIN', 'dietfarma');
define('YOUR_API_KEY', 'YOR_API_KEY');
try {
$loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/');
$token = $loginClient->getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);
$client = new JsonRpcClient('https://user-api.simplybook.me'/* . '/admin/'*/, array(
'headers' => array(
'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
'X-Token: ' . $token
)
));
} catch (Exception $e) {
echo 'Login fault';
var_dump($e);
exit();
}
echo $token;
$res = $client->getBooking(55,"c7d2d2a0c3addba9aa07cb213ae10dfb");
var_dump($res);
?>
this code works fine and result is
4object(stdClass)#4 (8) {
["id"]=>
string(2) "55"
["event_id"]=>
string(1) "1"
["unit_id"]=>
string(1) "3"
["client_id"]=>
string(2) "54"
["start_date_time"]=>
string(19) "2020-03-17 09:00:00"
["end_date_time"]=>
string(19) "2020-03-17 09:30:00"
["is_confirmed"]=>
string(1) "1"
["code"]=>
string(8) "vmg1i34s"
}